[Bug]: Inventory 'netbox_inventory.yml' parsing fails in Ubuntu 22.04 LTS to Netbox!!!! #1125
Replies: 9 comments 1 reply
-
What is returned when you do an HTTP GET to http://192.168.XXX.XX:8000/api/status |
Beta Was this translation helpful? Give feedback.
-
Can you try applying #1111 ? |
Beta Was this translation helpful? Give feedback.
-
Command on Netbox server:
Command on Ubuntu desktop:
Command on Kali box:
It shows port 8000 is closed but on Netbox is open: https://nmap.org/book/man-port-scanning-basics.html closed
I followed the installation from 'https://netboxlabs.com/blog/getting-started-with-network-automation-netbox-ansible/' Command on Netbox server:
Commands on Ubuntu box:
ubuntu:/opt/netbox$ curl -v -k -H "Authorization: Token REDACTED" https://192.168.XXX.XX:8000/api/status/
Based on this I tried the following formats on the netbox_inventory.yml: Option 1#plugin: netbox.netbox.nb_inventory ubuntu:/opt/netbox$ ansible-inventory -vvvv --list
Option 2# :/opt/netbox$ export NETBOX_TOKEN=REDACTED
:/opt/netbox$ ansible-inventory -vvvv --list
And what do you mean by ''Can you try applying #1111 ?' ? also what is see is that it loads the following collection '/usr/lib/python3/dist-packages/ansible_collections/netbox/netbox', but I have defined 'ansible collection location = /opt/netbox/collections' Any suggestions? |
Beta Was this translation helpful? Give feedback.
-
I am transferring this to a discussion. You need to determine what port your netbox installation is actually listening on, and the correct URL. To me it appears to be actually an HTTPs url that you need to use based on the curl output. That's the first step. |
Beta Was this translation helpful? Give feedback.
-
Dear sc68cal, See Option 1# and Option 2# from my last note and $ curl -v -k -H "Authorization: Token REDACTED" https://192.168.xxx.xx/api/status/. |
Beta Was this translation helpful? Give feedback.
-
Any other suggestions? |
Beta Was this translation helpful? Give feedback.
-
Even after updating some packages and updating OS, I still got the same error:
:/opt/netbox$ pip3 list
:/opt/netbox$ ansible-galaxy collection list
:/opt/netbox$ cat /etc/os-release
Test https://192.168.XXX.XX: As you can see, the api url '192.168.XXX.XX' works, so why not with ansible? Tried a again with the following config:
:/opt/netbox$ ansible-inventory -vvvv --list
Can anyone help me to make ansible work with netbox? |
Beta Was this translation helpful? Give feedback.
-
I found out the cause of this issue. In netbox_inventory.yml there is a variable called 'validate_certs:'. On True setting I got the error, but on False setting I did not get any error :/opt/netbox$ cat netbox_inventory.yml
:/opt/netbox$ ansible-inventory -vvvv --list
So why does 'validate_certs: True' not work with https self-signed certificates created from 'https://github.com/netbox-community/netbox/blob/develop/docs/installation/5-http-server.md'? |
Beta Was this translation helpful? Give feedback.
-
Self signed SSL certificates require you to disable certificate validation |
Beta Was this translation helpful? Give feedback.
-
Ansible NetBox Collection version
v3.15.0
Ansible version
/opt/netbox$ ansible --version
" ansible [core 2.15.6]
config file = /opt/netbox/ansible.cfg
configured module search path = ['/home/bc-dev01/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3/dist-packages/ansible
ansible collection location = /opt/netbox/collections
executable location = /usr/bin/ansible
python version = 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] (/usr/bin/python3)
jinja version = 3.0.3
libyaml = True"
/opt/netbox$ cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.1 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.1 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy
NetBox version
v3.6.5
Python version
3.10
Steps to Reproduce
I don't show the full IP.
Create the following ansible.cfg in main directory of the netbox project direcory. Here are the content:
Then I created the netbox_inventory.yml under directory 'inventory'. here by the content of netbox_inventory.yml:
$ ansible-galaxy collection list
$ pip3 list
Expected Behavior
Working dynamic inventory from my netbox server 192.168.XXX.XX (I do not show my full IP)
Observed Behavior
When I ran the following command I got this error:
/opt/netbox$ ansible-inventory -v --list
Deeper verbose information:
/opt/netbox$ ansible-inventory -vv --list
/opt/netbox$ ansible-inventory -vvv --list
/opt/netbox$ ansible-inventory -vvvv --list
Can any help to get ansible working with netbox or fix this bug.
If you need additional information, please contact me.
UPDATE 3-12-23
Tried also the following:
/opt/netbox$ export NETBOX_TOKEN=Netbox_API******************
/opt/netbox$ export NETBOX_API=http://192.168.XXX.XX:8000/
Update the 'netbox_inventory.yml':
/opt/netbox$ ansible-inventory -vvvv --list
And with '---' one line one:
/opt/netbox$ ansible-inventory -vvvv --list
Beta Was this translation helpful? Give feedback.
All reactions