问题描述
我一直想尝试可用于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/Latest/modules/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星系更新到最新的netbox模块:
I had to force ansible galaxy to update to the latest netbox module with:
ansible-galaxy collection install netbox.netbox -f
force选项对我有用.
The force option did the trick for me.
这篇关于使用Netbox Ansible模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!