在 AWX 上运行剧本时未检测到 Ansible 集合

问题描述

我在我的 ansible playbook 中使用集合 netapp.ontap 中的模块,当使用 ansible-playbook 命令运行时,它工作得非常好。 但是,当从 AWX 运行时,它无法检测到集合并立即抛出无法检测到 ansible 模块/集合的错误。 我什至尝试从剧本本身重新安装该系列,但没有成功。

已确认安装 ansible 集合,因为它在 AWX 之外运行时已经可以正常工作了。

主机正在运行 ansible 2.10.4。

这是我的剧本:

---
- hosts: all
  gather_facts: yes
 
  collections:
  - netapp.ontap

  tasks: 
   
  - name: Install Netapp Collection from Ansible galaxy
    shell: ansible-galaxy collection install netapp.ontap


  - name: Run Task
    import_tasks: tasks/hil.yml

任务:

- name: 'Gather SVMs'
  netapp.ontap.na_ontap_info:
    state: info
    hostname: "{{ netapp_hostname }}"  
    username: "{{ netapp_username }}"
    password: "{{ netapp_hv_password }}"
    gather_subset:
    - vserver_info

来自 AWX 的错误

SSH password: 
Vault password: 
ERROR! Couldn't resolve module/action 'netapp.ontap.na_ontap_info'. This often indicates a misspelling,missing collection,or incorrect module path.
The error appears to be in '/tmp/awx_421_gey54bdw/project/tasks/hil.yml': line 6,column 3,but may
be elsewhere in the file depending on the exact Syntax problem.
The offending line appears to be:
- name: 'Gather SVMs'
  ^ here
This one looks easy to fix. It seems that there is a value started
with a quote,and the YAML parser is expecting to see the line ended
with the same kind of quote. For instance:
    when: "ok" in result.stdout
Could be written as:
   when: '"ok" in result.stdout'
Or equivalently:
   when: "'ok' in result.stdout"

更新: 我创建了一个 collections/requirements.yml 文件,其中包含以下详细信息,但现在 AWX 本身无法完成任务。

collections/requirements.yml

collections:
   name: https://github.com/ansible-collections/netapp.git
   type: git

错误

"/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/main/tasks.py",line 1279,in run self.pre_run_hook(self.instance,private_data_dir) File 
"/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/main/tasks.py",line 1862,in pre_run_hook sync_task.run(local_project_sync.id) File 
"/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/main/tasks.py",line 698,in _wrapped return f(self,*args,**kwargs) File 
"/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/main/tasks.py",line 1444,in run raise AwxTaskError.TaskError(self.instance,rc) 
Exception: project_update 435 (Failed) encountered an error (rc=2),please 
see task stdout for details.

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)