如何在ansible.cfg文件中添加多个库路径

2024-05-17 01:20:51 发布

您现在位置:Python中文网/ 问答频道 /正文

我已经用pip安装了napalmansible,现在尝试将napalmansible库路径添加到我的ansible.cfg公司文件。在

root@usvr-1804:/home/labadmin# napalm-ansible
To ensure Ansible can use the NAPALM modules you will have
to add the following configurtion to your Ansible configuration
file (ansible.cfg):

[defaults]
library = /usr/local/lib/python2.7/dist-packages/napalm_ansible/modules
action_plugins = /usr/local/lib/python2.7/dist 
packages/napalm_ansible/plugins/action

但是我的ansible.cfg公司文件已具有库路径。在

^{pr2}$

如何将第二个库路径添加到ansible.cfg公司文件。谢谢


Tags: 文件theto路径moduleslibusrlocal
2条回答

转到the docs for the Ansible Configuration Settings ,找到正确的参数^{}

library Colon separated paths in which Ansible will search for Modules.

然后相应地配置:

library = /etc/ansible/roles/PaloAltoNetworks.paloaltonetworks:/usr/local/lib/python2.7/dist-packages/napalm_ansible/modules

您可以将任意多个路径放入library参数中,只需在每个路径之间加一个冒号(documentation

library = /foo/bar:/foo/baz

相关问题 更多 >