gekmihesg / ansible-openwrt

Manage OpenWRT and derivatives with Ansible but without Python
GNU General Public License v3.0
363 stars 63 forks source link

Support for Ansible-core >= 2.10 #45

Open lowjoel opened 2 years ago

lowjoel commented 2 years ago

Hello there, I've tried to use this role with Ansible-core 2.12.6:

ansible-playbook [core 2.12.6]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/joel/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  ansible collection location = /home/joel/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible-playbook
  python version = 3.10.4 (main, Apr  2 2022, 09:04:19) [GCC 11.2.0]
  jinja version = 3.0.3
  libyaml = True

And I get this failure:

task path: /home/joel/.ansible/roles/gekmihesg.openwrt/tasks/main.yml:16
redirecting (type: modules) ansible.builtin.opkg to community.general.opkg
fatal: [hostname]: FAILED! => {"reason": "couldn't resolve module/action 'opkg'. This often indicates a misspelling, missing collection, or incorrect module path.\n\nThe error appears to be in '/home/joel/.ansible/roles/gekmihesg.openwrt/tasks/packages.yml': line 14, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: update opkg cache\n  ^ here\n"}

I tried changing the opkg module in both the role code and my own Ansible code but it seems that the gekmihesg.openwrt.opkg module can't be found either. I'm guessing somewhere in the refactor to collections the logic that this role uses changed? I'd love to help to submit a patch, but unfortunately I'm lost as to where to begin right now.

Any advice/direction appreciated!

lowjoel commented 2 years ago

(Meanwhile I'll use Ansible 2.10, which is known to work, but IIRC is now EOL)

lowjoel commented 2 years ago

Oh, it seems that running ansible-galaxy collections install community.general is now needed. That seems to fix it for both versions. Should this be documented somewhere, or should there be some dependency specified in the meta.yml?

Hurricos commented 2 years ago

Oh, it seems that running ansible-galaxy collections install community.general is now needed. That seems to fix it for both versions. Should this be documented somewhere, or should there be some dependency specified in the meta.yml?

Oddly enough, I can't reproduce this with ansible-core 2.12.7; things function for me without community.general.