ansible_modules icon indicating copy to clipboard operation
ansible_modules copied to clipboard

[Bug]: inventory plugin does not support netbox running on path-based endpoints

Open lanefu opened this issue 8 months ago • 0 comments

Ansible NetBox Collection version

v3.21.0

Ansible version

ansible [core 2.18.4]
  config file = /Users/lane/GIT/LANECLOUD/tmp/netbox-ansible_modules/ansible.cfg
  configured module search path = ['/Users/lane/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/lane/GIT/LANECLOUD/lanecloud_infra/venv/lib/python3.12/site-packages/ansible
  ansible collection location = /Users/lane/.ansible/collections:/usr/share/ansible/collections
  executable location = /Users/lane/GIT/LANECLOUD/lanecloud_infra/venv/bin/ansible
  python version = 3.12.4 (main, Jul  7 2024, 16:39:30) [Clang 15.0.0 (clang-1500.3.9.4)] (/Users/lane/GIT/LANECLOUD/lanecloud_infra/venv/bin/python3)
  jinja version = 3.1.6
  libyaml = True

NetBox version

v3.5.5

Python version

3.11

Steps to Reproduce

Deploy netbox in a not-root path.. such as https://myserver.example.com/netbox/ and query with inventory plugin

Expected Behavior

Normal inventory result set

Observed Behavior

Empty result set. The inventory plugin queries net box's OpenAPI endpoint, and composes the API paths from the OpenAPI output. However, the inventory plugin doesn't factor in the full url of the netbox server when querying the API. It always assumes netbox is running at the root context.. aka server.example.com/ and composes the inventory API points accordingly, ignoring any subpath such as /netbox/

Other components are aware of the base path, it seems to just be the inventory plugin.

lanefu avatar Apr 13 '25 12:04 lanefu