Ansible
如何在 Ansible Tower 中使用集合
我們正在使用具有 Ansible 2.9.13 的 Ansible Tower 3.7.4,我們還安裝了“theforeman”ansible 集合。
我的測試劇本是
--- - name: Test foreman roles hosts: localhost become: false gather_facts: false tasks: - add_host: name: victim.local group: my_inv - name: Test foreman roles hosts: my_inv become: false gather_facts: false tasks: - theforeman.foreman.host: server_url: "https://foreman-server.local" username: "admin" password: "password" parameters: name: "param_name" value: "param_value" parameter_type: "string" delegate_to: localhost
無論我使用’theforeman.foreman.host’還是只使用’host’,都報告“錯誤!無法解析模組/操作”
定位命令顯示安裝路徑:
locate theforeman | grep host /var/lib/awx/vendor/inventory_collections/ansible_collections/theforeman/foreman/plugins/modules/foreman_host.py /var/lib/awx/vendor/inventory_collections/ansible_collections/theforeman/foreman/plugins/modules/foreman_host_power.py /var/lib/awx/vendor/inventory_collections/ansible_collections/theforeman/foreman/plugins/modules/foreman_hostgroup.py /var/lib/awx/vendor/inventory_collections/ansible_collections/theforeman/foreman/plugins/modules/katello_host_collection.py
我把它放在 ansible.cfg 文件中:
grep collections /etc/ansible/ansible.cfg collections_paths = /var/lib/awx/vendor/inventory_collections/ansible_collections
如何使用已安裝的集合?
謝謝
ansible_collections
是集合路徑下目錄結構的一部分,不應包含在搜尋路徑中。collections_paths = /var/lib/awx/vendor/inventory_collections