问题描述
我一直想尝试可用于 Netbox [1] 的 Ansible 模块.
I've been wanting to try out Ansible modules available for Netbox [1].
然而,我发现自己一开始就陷入困境.
However, I find myself stuck right in the beginning.
这是我尝试过的:
将前缀/VLAN 添加到 netbox [2]:
Add prefix/VLAN to netbox [2]:
cat setup-vlans.yml
---
- hosts: netbox
tasks:
- name: Create prefix 192.168.10.0/24 in Netbox
netbox_prefix:
netbox_token: "{{ netbox_token }}"
netbox_url: "{{ netbox_url }}"
data:
prefix: 192.168.10.0/24
state: present
这给了我以下错误:
ansible-playbook setup-vlans.yml
PLAY [netbox] *********************************************************************************************************************************
TASK [Gathering Facts] ************************************************************************************************************************
ok: [NETBOX]
TASK [Create prefix 192.168.10.0/24 in Netbox] ************************************************************************************************
fatal: [NETBOX]: FAILED! => {"changed": false, "msg": "Failed to establish connection to Netbox API"}
PLAY RECAP ************************************************************************************************************************************
NETBOX : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
有人可以指出我哪里出错了吗?
Can someone please point me where I am going wrong?
注意:NetBox URL 是使用 nginx 和 netbox-docker [3] 设置的 https://url.
Note: The NetBox URL is an https://url setup with nginx and netbox-docker [3].
谢谢&问候,萨那
Thanks & Regards,Sana
[1] https://github.com/netbox-community/ansible_modules
[2] https://docs.ansible.com/ansible/最新/模块/netbox_prefix_module.html
[3]https://github.com/netbox-community/netbox-docker
推荐答案
我也有同样的情况.显然 pynetbox api 在实例化方面发生了变化(ssl_verify 现在被请求会话参数取代).
I had the same. Apparently the pynetbox api has changed in instantiation (ssl_verify is now replaced by requests session parameters).
我不得不强制 ansible Galaxy 更新到最新的 netbox 模块:
I had to force ansible galaxy to update to the latest netbox module with:
ansible-galaxy 合集安装 netbox.netbox -f
强制选项对我有用.
这篇关于使用 Netbox Ansible 模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!