【问题标题】:How do I add several library path in ansible.cfg file如何在 ansible.cfg 文件中添加多个库路径
【发布时间】:2019-02-06 18:22:01
【问题描述】:

我已经使用 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

但是我的 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

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

【问题讨论】:

    标签: python ansible library-path


    【解决方案1】:

    您可以在library 参数中添加任意数量的路径,您只需在每个路径之间添加一个冒号 (documentation)

    library = /foo/bar:/foo/baz
    

    【讨论】:

      【解决方案2】:

      转到the docs for the Ansible Configuration Settings ,找到正确的参数library

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

      然后进行相应的配置:

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

      【讨论】:

      • 谢谢大家的回答
      猜你喜欢
      • 2020-01-02
      • 2020-07-03
      • 2015-04-20
      • 1970-01-01
      • 1970-01-01
      • 2022-10-08
      • 1970-01-01
      • 2016-04-02
      • 1970-01-01
      相关资源
      最近更新 更多