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

R.a*_*hir 5 python library-path ansible

我已经使用 pip 安装了 napalm-ansible,现在尝试将 napalm-ansible 库路径添加到我的 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
Run Code Online (Sandbox Code Playgroud)

但我的 ansible.cfg 文件已经有一个库路径。

root@usvr-1804:/home/labadmin# cat ansible.cfg

[defaults]
inventory = ./hosts
library = /etc/ansible/roles/PaloAltoNetworks.paloaltonetworks
host_key_checking = false
timeout = 5
log_path = /var/log/ansible.log
roles_path = /etc/ansible/roles
Run Code Online (Sandbox Code Playgroud)

如何将第二个库路径添加到我的 ansible.cfg 文件中。谢谢

tec*_*raf 4

转到Ansible 配置设置的文档 ,找到正确的参数library

libraryAnsible 将在其中搜索模块的冒号分隔路径。

然后进行相应配置:

library = /etc/ansible/roles/PaloAltoNetworks.paloaltonetworks:/usr/local/lib/python2.7/dist-packages/napalm_ansible/modules
Run Code Online (Sandbox Code Playgroud)