Custom field for tags #9646

Open
opened 2025-12-29 21:20:15 +01:00 by adam · 9 comments
Owner

Originally created by @fprina on GitHub (May 10, 2024).

NetBox version

v3.7.8

Feature type

New functionality

Proposed functionality

Permits extending tag information with custom fields, as is done with other object types.

Use case

I use tags in Ansible playbook/templates and it would be great to add extra information based on them.

In the specific:

I create firewall host groups using Netbox tags, but I don't need to create groups for all the tags. I've implemented a filter in Ansible based on tag colors to distinguish them.
However, it's clear that this solution isn't well-designed.

Adding custom fields also to tags could offer more flexibility and maybe permit me to add different logics.

Database changes

No response

External dependencies

No response

Originally created by @fprina on GitHub (May 10, 2024). ### NetBox version v3.7.8 ### Feature type New functionality ### Proposed functionality Permits extending tag information with custom fields, as is done with other object types. ### Use case I use tags in Ansible playbook/templates and it would be great to add extra information based on them. In the specific: I create firewall host groups using Netbox tags, but I don't need to create groups for all the tags. I've implemented a filter in Ansible based on tag colors to distinguish them. However, it's clear that this solution isn't well-designed. Adding custom fields also to tags could offer more flexibility and maybe permit me to add different logics. ### Database changes _No response_ ### External dependencies _No response_
Author
Owner

@jeffgdotorg commented on GitHub (May 13, 2024):

Thank you for your interest in improving NetBox. We need more detail before we can consider implementing this request.

Please edit the issue body to expand your use case with Ansible usage examples showing how the proposed functionality would be used. The YAML example from the netbox.netbox.netbox_tag module docs might make a good starting point, but examples adapted from your own plays are also great.

@jeffgdotorg commented on GitHub (May 13, 2024): Thank you for your interest in improving NetBox. We need more detail before we can consider implementing this request. Please edit the issue body to expand your use case with Ansible usage examples showing how the proposed functionality would be used. The YAML example from the [`netbox.netbox.netbox_tag` module docs](https://docs.ansible.com/ansible/latest/collections/netbox/netbox/netbox_tag_module.html#ansible-collections-netbox-netbox-netbox-tag-module) might make a good starting point, but examples adapted from your own plays are also great.
Author
Owner

@jeffgdotorg commented on GitHub (May 14, 2024):

@fprina the revisions are a good start and I thank you for making them, but I need you to make a more concrete case. You need to sell a developer on the idea of spending an hour or two doing this work. Perhaps use a sanitized version of one of your existing plays as a starting point, and show how you imagine this enhancement would improve things and make your life (and other users' lives!) easier.

@jeffgdotorg commented on GitHub (May 14, 2024): @fprina the revisions are a good start and I thank you for making them, but I need you to make a more concrete case. You need to sell a developer on the idea of spending an hour or two doing this work. Perhaps use a sanitized version of one of your existing plays as a starting point, and show how you imagine this enhancement would improve things and make your life (and other users' lives!) easier.
Author
Owner

@fprina commented on GitHub (May 14, 2024):

@jeffgdotorg, I understand your point, but in this case, I don't really have concrete details able to sell the idea.

My playbook is quite basic, just a lookup like
{{ query('netbox.netbox.nb_lookup', 'tags', api_endpoint=netbox_url, token=netbox_token, api_filter='color=00bcd4' ) }}

but it would be better to use a clearer filter.

For example, a boolean like cf_firewall_group=true would be great.
Or maybe I could extend my implementation adding a text field with the firewall group name.

The recap is: looks like the only object type without CF are tag so would be nice have them. nothing more nothing less.

@fprina commented on GitHub (May 14, 2024): @jeffgdotorg, I understand your point, but in this case, I don't really have concrete details able to sell the idea. My playbook is quite basic, just a lookup like `{{ query('netbox.netbox.nb_lookup', 'tags', api_endpoint=netbox_url, token=netbox_token, api_filter='color=00bcd4' ) }}` but it would be better to use a clearer filter. For example, a boolean like `cf_firewall_group=true` would be great. Or maybe I could extend my implementation adding a text field with the firewall group name. The recap is: looks like the only object type without CF are tag so would be nice have them. nothing more nothing less.
Author
Owner

@jeffgdotorg commented on GitHub (May 15, 2024):

The completeness argument suffices to move your issue along to needs owner status. If you would like to volunteer to work it through to a PR, please indicate and a maintainer will assign the issue to you. Otherwise, another developer with the requisite skills and capacity can pick it up.

@jeffgdotorg commented on GitHub (May 15, 2024): The completeness argument suffices to move your issue along to `needs owner` status. If you would like to volunteer to work it through to a PR, please indicate and a maintainer will assign the issue to you. Otherwise, another developer with the requisite skills and capacity can pick it up.
Author
Owner

@jeremystretch commented on GitHub (May 16, 2024):

This would effect an API change for the Tag model, and therefore needs a milestone designation.

@jeremystretch commented on GitHub (May 16, 2024): This would effect an API change for the Tag model, and therefore needs a milestone designation.
Author
Owner

@ghost commented on GitHub (Jul 18, 2024):

This would be a great addition. The ability to add custom fields to tags might also address the need for the following plugin : https://plugin-ideas.netbox.dev/ideas/PLUGINS-I-31

Rather than needing to create the plugin at all, or add a bunch of new models, you could simply 'tag' a device with a "contract" then add what ever custom fields for that tag that are appropriate for your environment/use case.

@ghost commented on GitHub (Jul 18, 2024): This would be a great addition. The ability to add custom fields to tags might also address the need for the following plugin : https://plugin-ideas.netbox.dev/ideas/PLUGINS-I-31 Rather than needing to create the plugin at all, or add a bunch of new models, you could simply 'tag' a device with a "contract" then add what ever custom fields for that tag that are appropriate for your environment/use case.
Author
Owner

@antoinekh commented on GitHub (Jan 25, 2025):

Could be very useful.
For example, we use tag to identify items to project code. with custom fields on tag we will be able to add more information on this tag

@antoinekh commented on GitHub (Jan 25, 2025): Could be very useful. For example, we use tag to identify items to project code. with custom fields on tag we will be able to add more information on this tag
Author
Owner

@PieterL75 commented on GitHub (Jul 11, 2025):

I once proposed to allow 'tags' on 'tags', just for this purpose.
then you can group all 'tags' that have one purpose with an extra tag on the tag (pfiew)
But having custom fields on tags would also solve this.
+1 from me

@PieterL75 commented on GitHub (Jul 11, 2025): I once proposed to allow 'tags' on 'tags', just for this purpose. then you can group all 'tags' that have one purpose with an extra tag on the tag (pfiew) But having custom fields on tags would also solve this. +1 from me
Author
Owner

@pchiquit commented on GitHub (Sep 15, 2025):

I'm trying to implement permissions for tags using a custom field called tenant, so this feature would be very helpful.

@pchiquit commented on GitHub (Sep 15, 2025): I'm trying to implement permissions for tags using a custom field called tenant, so this feature would be very helpful.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#9646