Add ability to search for devices/VMs which do not have a given tag #5537

Closed
opened 2025-12-29 19:29:07 +01:00 by adam · 4 comments
Owner

Originally created by @BarbarossaTM on GitHub (Oct 20, 2021).

NetBox version

v3.0.3

Feature type

Change to existing functionality

Proposed functionality

It would be nice to be able to filter for devices or VMs which do not have a given tag applied.

Use case

When migrating parts of the infrastructure to new versions or new tooling we currently use tags to indicate that a device or a VM should get the "new stuff" which works fine. Our automation consumes the tags applied to the device/VM and does the right thing. To see which devices/VMs have to be migrated it would be nice if we could filter for devices/VMs which do not have the tag applied yet.

Database changes

None.

External dependencies

None.

Originally created by @BarbarossaTM on GitHub (Oct 20, 2021). ### NetBox version v3.0.3 ### Feature type Change to existing functionality ### Proposed functionality It would be nice to be able to filter for devices or VMs which do **not** have a given tag applied. ### Use case When migrating parts of the infrastructure to new versions or new tooling we currently use tags to indicate that a device or a VM should get the "new stuff" which works fine. Our automation consumes the tags applied to the device/VM and does the right thing. To see which devices/VMs have to be migrated it would be nice if we could filter for devices/VMs which do not have the tag applied yet. ### Database changes None. ### External dependencies None.
adam added the type: feature label 2025-12-29 19:29:07 +01:00
adam closed this issue 2025-12-29 19:29:07 +01:00
Author
Owner

@tyler-8 commented on GitHub (Oct 20, 2021):

You can do this today on just about any endpoint with a tag filter - there's also the tag__n filter.

If you only want objects that do not contain tag-x you would add tag__n=tag-x to your query parameters. This works in both the GUI and API - although the negation filter isn't visible in the GUI, the URL query does render the proper results.

@tyler-8 commented on GitHub (Oct 20, 2021): You can do this today on just about any endpoint with a `tag` filter - there's also the `tag__n` filter. If you only want objects that do not contain `tag-x` you would add `tag__n=tag-x` to your query parameters. This works in both the GUI and API - although the negation filter isn't visible in the GUI, the URL query does render the proper results.
Author
Owner

@BarbarossaTM commented on GitHub (Oct 20, 2021):

Thanks @tyler-8, that's a nice workaround :)

@BarbarossaTM commented on GitHub (Oct 20, 2021): Thanks @tyler-8, that's a nice workaround :)
Author
Owner

@jeremystretch commented on GitHub (Oct 21, 2021):

@BarbarossaTM does the solution @tyler-8 provided meet your needs for this FR?

This works in both the GUI and API - although the negation filter isn't visible in the GUI

Tangential, but I'd like to improve the UI filter forms to support this, somehow. I've opened #7604 to propose an idea.

@jeremystretch commented on GitHub (Oct 21, 2021): @BarbarossaTM does the solution @tyler-8 provided meet your needs for this FR? > This works in both the GUI and API - although the negation filter isn't visible in the GUI Tangential, but I'd like to improve the UI filter forms to support this, somehow. I've opened #7604 to propose an idea.
Author
Owner

@BarbarossaTM commented on GitHub (Oct 21, 2021):

Yes, adding ?tag__n=xxx to the URL works fine for now and provides me the result I want, so I can work. Would be cool to be able to add this filter via the GUI, so if that's the intention for #7604 that would be great :)

@BarbarossaTM commented on GitHub (Oct 21, 2021): Yes, adding `?tag__n=xxx` to the URL works fine for now and provides me the result I want, so I can work. Would be cool to be able to add this filter via the GUI, so if that's the intention for #7604 that would be great :)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#5537