I just installed AWX recently and I’ve some problems getting the collections working.
I installed AWX via the AWX operator on a k3s instance (single node). I followed the instructions according to the AWX-operator page including the demo instance.
I’m using GIT as project source and created a collections/requirements.yml file in it.
When I launch a template I get the following message:
ERROR! couldn’t resolve module/action ‘iptables_state’. This often indicates a misspelling, missing collection, or incorrect module path.
I’ve looked at several thing and found out the following:
Wen the project is updated the collections/requirements.yml is fetched. It only stores the collections in “/var/lib/awx/projects/.__awx_cache/…”
If I look at the collection location this path is not included:
ansible collection location = /runner/requirements_collections:/home/runner/.ansible/collections:/usr/share/ansible/collections
The installation is straight forward and according to the documentation on https://github.com/ansible/awx-operator. I didn’t changed anything except adding credentials, an inventory, a project and a template.
I’m also using the default execution environment as it comes with the installation.
I’m using AWX-operator 0.15 and AWX 19.5
I guess I do something wrong as it seems like others don’t have this issue but I don’t know what.
Sorry to hear you are having issues. I am interested in this thread since I also deployed via kurokobo’s repo on K3S (running 19.4.0 for now).
I think it would help if you are able to post your testcase publically (e.g Github), so that people can help by importing it into their AWX instance, running it and reporting back.
On my end, I started to use the automatic for collections (the one you are using, pulling in collections/roles at project sync) but quickly moved to building a custom Execution Environment, mostly because 1/I had specific tools I needed not included in the standard EE and 2/this considerably sped up project syncs (no need to access Galaxy anymore).
By default there were Ansible Galaxy credentials assigned to the default organisation. To be sure I made a copy of the default one and added a token to it and added this one to the default organisation. This didn’t make any difference.
When I check the project sync the pulling off the collections is working and successful. Only the playbooks don’t see the pulled collections.
The result of pulling the collections:
ansible-galaxy [core 2.11.7.post0]
config file = /var/lib/awx/projects/_8__project/ansible.cfg
configured module search path = ['/home/runner/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.8/site-packages/ansible
ansible collection location = /var/lib/awx/projects/.__awx_cache/_8__project/stage/requirements_collections
executable location = /usr/local/bin/ansible-galaxy
python version = 3.8.12 (default, Sep 21 2021, 00:10:52) [GCC 8.5.0 20210514 (Red Hat 8.5.0-3)]
jinja version = 2.10.3
libyaml = True
Using /var/lib/awx/projects/_8__project/ansible.cfg as config file
Reading requirement file at '/var/lib/awx/projects/_8__project/collections/requirements.yml'
Starting galaxy collection install process
Process install dependency map
Opened /home/runner/.ansible/galaxy_token
Starting collection install process
Downloading https://galaxy.ansible.com/download/community-general-4.3.0.tar.gz to /var/lib/awx/projects/.__awx_cache/_8__project/stage/tmp/ansible-local-3692945q2lu/tmpyhrnjp8j/community-general-4.3.0-_6rhuoi6
Collection 'community.general:4.3.0' obtained from server server0 https://galaxy.ansible.com/api/
Installing 'community.general:4.3.0' to '/var/lib/awx/projects/.__awx_cache/_8__project/stage/requirements_collections/ansible_collections/community/general'
community.general:4.3.0 was installed successfully
The result of the ansible playbook:
ansible-playbook [core 2.11.7.post0]
config file = /runner/project/ansible.cfg
configured module search path = [‘/home/runner/.ansible/plugins/modules’, ‘/usr/share/ansible/plugins/modules’]
ansible python module location = /usr/local/lib/python3.8/site-packages/ansible
ansible collection location = /runner/requirements_collections:/runner/project/collections:/home/runner/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/local/bin/ansible-playbook
python version = 3.8.12 (default, Sep 21 2021, 00:10:52) [GCC 8.5.0 20210514 (Red Hat 8.5.0-3)]
jinja version = 2.10.3
libyaml = True
Using /runner/project/ansible.cfg as config file
host_list declined parsing /runner/inventory/hosts as it did not pass its verify_file() method
Parsed /runner/inventory/hosts inventory source with script plugin
redirecting (type: modules) ansible.builtin.sysctl to ansible.posix.sysctl
ERROR! couldn’t resolve module/action ‘iptables_state’. This often indicates a misspelling, missing collection, or incorrect module path.
The error appears to be in ‘/runner/project/roles/docker/handlers/main.yml’: line 8, column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
name: save iptables
^ here
When I run this project without AWX (just cli) it’s working fine.
I will create a public repo for this with the same config as the current one as we are using a private one at the moment.
I created a public repo with content (similar to the repo which I have problems with) and get the same result.
The url of the repo is: https://github.com/mvdboogaard/project
well… looks like I found the problem.
I use some community collections and apparently it’s not possible (anymore) to use the short names for these modules. I changed the short names of those modules to the full name (like community.general.iptables_state) and it’s working.