0

netapp.ontap我在我的 ansible playbook 中使用集合中的模块,当使用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 本身无法完成任务。

集合/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.
4

0 回答 0