0

I am new to Ansible and very new to Ansible Tower 3.7.4 with Ansbile 2.9.15. I am trying to do a basic Template that runs an ansible script in a Git repo. Note: if I install ansible on a linux box with python, and ansible-galaxy, I can pull the collections and everything works fine. However, in Ansible Tower, it is not seeing my collections to pull from ansible-galaxy. Here is the error I am getting

ERROR! couldn't resolve module/action 'community.kubernetes.k8s'. This often indicates a misspelling, missing collection, or incorrect module path.

I have a requirements.yml file in the collections directory at the main level of my ansible playbook. This is its contenet

collections:
- name: community.aws
- name: community.kubernetes

the directory structure is

- ansible
  - collections
    - requirements.yml
  - roles
    - openshift
      - tasks
        - main.yml
  - main.yml

Here is the full output when I run the template in Ansible Tower

ansible-playbook 2.9.15
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/var/lib/awx/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 2.7.5 (default, Aug 13 2020, 02:51:10) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
Using /etc/ansible/ansible.cfg as config file
SSH password: 
host_list declined parsing /tmp/awx_66_8ffiwxxz/tmp32f5fpkw as it did not pass its verify_file() method
Parsed /tmp/awx_66_8ffiwxxz/tmp32f5fpkw inventory source with script plugin
ERROR! couldn't resolve module/action 'community.kubernetes.k8s'. This often indicates a misspelling, missing collection, or incorrect module path.
The error appears to be in '/tmp/awx_66_8ffiwxxz/project/confluent/ansible/roles/openshift/tasks/main.yml': line 17, column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
# Ensure namespace is created
- name: Create Confluent namespace / project
  ^ here

Any idea what I am doing wrong?

ajpieri
  • 306
  • 3
  • 11
  • Did you allow tower to download collections from projects? – Zeitounator May 06 '21 at 06:35
  • I do not know what you mean. Where would I "allow it to download collections" in the projects? I do not see anything like that in the project I created. Is this something in the settings for Tower? In settings->jobs I did turn on "Enable collection(s) Downloads" – ajpieri May 07 '21 at 13:44
  • 1
    In the administration section. https://docs.ansible.com/ansible-tower/latest/html/administration/configure_tower_in_tower.html#jobs – Zeitounator May 07 '21 at 17:31
  • I haven't been able to full test things yet, but I was able to get past the error by taking off the "community.kubernetes." portion of the module where I used it in my playbook – ajpieri May 13 '21 at 21:22

0 Answers0