Search code examples
ansibleansible-templateansible-awx

Ansible AWX use collections


My ansible playbook failes, when starting the template in AWX.

ansible-playbook [core 2.11.0b4] 
  config file = None
  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:/home/runner/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible-playbook
  python version = 3.8.3 (default, Aug 31 2020, 16:03:14) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)]
  jinja version = 2.10.3
  libyaml = True
No config file found; using defaults
SSH password: 
BECOME password[defaults to SSH password]: 
ERROR! couldn't resolve module/action 'community.general.archive'. This often indicates a misspelling, missing collection, or incorrect module path.

There is a roles/requirements.yaml in poject folder and it gets installed after I sync the project:

Starting galaxy role install process
- extracting community.general to /var/lib/awx/projects/.__awx_cache/_8__gitlab/stage/requirements_roles/community.general
- community.general (main) was installed successfully 

This is my playbook:

---
- name: Backup Folder
  hosts: all
  tasks:
  - name: zipping folder
    become: yes
    community.general.archive:
      path: /home/backup/{{name}}
      dest: /home/backup/{{name}}.zip
      format: zip

Solution

  • I was mixing things up. I tried to install a collection as a roll. I fixed it by renaming the "roles" folder to "collections" (folder with the requirements.yml) and changed some syntax.