首页 > 解决方案 > Ansible AWX 使用集合

问题描述

在 AWX 中启动模板时,我的 ansible playbook 失败。

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.

poject文件夹中有一个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

标签: ansibleansible-templateansible-awx

解决方案


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


推荐阅读