Skip to content

[Bug]: Inventory Plugin with Custom Field Query Filter is not working as expected #1365

Open
@cryptolukas

Description

@cryptolukas

Ansible NetBox Collection version

3.20.0

Ansible version

ansible [core 2.18.1]
  configured module search path = ['/home/lukas/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.13/site-packages/ansible
  ansible collection location = /home/lukas/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.13.1 (main, Dec  4 2024, 18:05:56) [GCC 14.2.1 20240910] (/usr/bin/python)
  jinja version = 3.1.5
  libyaml = True

NetBox version

v3.7.8

Python version

3.10

Steps to Reproduce

Create a custom field foo as text with default search matching

assign the custom field to a virtual machine object and set a value to bar

virtualization | interface
ipam | IP address
virtualization | virtual machine

Create a nb inventory like

plugin: netbox.netbox.nb_inventory
api_endpoint: https://netboxexample.com
validate_certs: true
query_filters:
  - cf_foo: bar

Expected Behavior

Result should be ansible inventory contains all virtual machines with the assigned custom field foo and value bar.

Observed Behavior

The filter is not working and i get all devices back.

The API call is working as expected
api/virtualization/virtual-machines/\?limit=0\&cf_foo\=bar\&exclude\=config_context

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions