我正在安装ansible.posix
要在我的剧本中使用的集合,如下所示:
ansible-galaxy collection install -r ansible/requirements.yml -p ansible/collections
但是,我收到了我想摆脱的警告消息:
[WARNING]: The specified collections path '/home/myuser/path/to/my/repo/ansible/collections' is not part of the
configured Ansible collections paths '/home/myuser/.ansible/collections:/usr/share/ansible/collections'. The installed collection won't be
picked up in an Ansible run.
我的仓库是这样布置的:
├── ansible
│ ├── playbook.yml
│ ├── files
│ │ ├── ...
│ ├── tasks
│ │ ├── ...
│ ├── requirements.yml
├── ansible.cfg
...
ansible.cfg
看起来像这样:
[defaults]
timeout = 60
callback_whitelist = profile_tasks
这是输出ansible --version
:
ansible 2.9.17
config file = /home/myuser/path/to/my/repo/ansible.cfg
configured module search path = ['/home/myuser/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.7/dist-packages/ansible
executable location = /usr/local/bin/ansible
python version = 3.7.3 (default, Jul 25 2020, 13:03:44) [GCC 8.3.0]
在使用 安装集合的文档中ansible-galaxy
,他们说如下:
您还可以在
collections/ansible_collections/
目录结构下保持与当前剧本相邻的集合。play.yml ├── collections/ │ └── ansible_collections/ │ └── my_namespace/ │ └── my_collection/<collection structure lives here>
而且,就像文档所暗示的那样,我仍然可以在我的游戏中很好地使用该集合。但是这个警告信息很烦人。我该如何摆脱它?