Ansible AWX 使用集合

Ansible AWX use collections

在 AWX 中启动模板时,我的 ansible 剧本失败了。

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.

项目文件夹中有一个 roles/requirements.yaml,它在我同步项目后安装:

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 

这是我的剧本:

---
- 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

我把事情搞混了。我试图将一个集合安装为一个卷。我通过将“roles”文件夹重命名为“collections”(带有 requirements.yml 的文件夹)并更改了一些语法来修复它。