我通过一个私有的git存储库安装了我自己的集合
ansible-galaxy collection install <clone URL of the git repository>,<version>,它将集合安装到
~/.ansbile/collections/ansible_collections/<namespace>/<name>检查~/.ansbile/collections/ansible_collections/<namespace>/<name>
根据文档https://docs.ansible.com/ansible/latest/user_guide/collections_using.html#using-a-playbook-from-a-collection,我应该能够通过
ansible-playbook <namespace>.<name>.<my_playbook> -i <path to my inventory> --check --ask-become-pass但是我得到了一个错误
ERROR! the playbook: <namespace>.<name>.<my_playbook> could not be found正在检查
$ ansible-config dump | grep collection
COLLECTIONS_PATHS(default) = ['~/.ansible/collections', '/usr/share/ansible/collections']和
$ ansible --version
ansible [core 2.13.0]
config file = None
configured module search path = ['~/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /opt/conda/envs/ansible/lib/python3.9/site-packages/ansible
ansible collection location = ~/.ansible/collections:/usr/share/ansible/collections
executable location = /opt/conda/envs/ansible/bin/ansible
python version = 3.9.13 | packaged by conda-forge | (main, May 27 2022, 16:56:21) [GCC 10.3.0]
jinja version = 3.1.2
libyaml = True手动指定到剧本的路径。
ansible-playbook ~/.ansible/collections/ansible_collections/<namespace>/<name>/playbooks/files/<my_playbook>.yml -i <path to my inventory> --check --ask-become-pas也能像预期的那样工作。
我在这里错过了什么?
发布于 2022-06-22 09:52:56
好吧,原来剧本应该在
~/.ansible/collections/ansible_collections/<namespace>/<name>/playbooks/<my_playbook>.yml而不是在
~/.ansible/collections/ansible_collections/<namespace>/<name>/playbooks/files/<my_playbook>.ymlhttps://stackoverflow.com/questions/72713145
复制相似问题