Feature/tenant data - #1537
Open
J0kerul wants to merge 5 commits into
Open
Feature/tenant data#1537J0kerul wants to merge 5 commits into
J0kerul wants to merge 5 commits into
Conversation
Adds a new tenant_data boolean option (default: false) that controls whether the full tenant data structure from the NetBox API is included in host vars, or just the slug string. This mirrors the existing site_data option behavior: - When false: host var 'tenant' contains only the slug - When true: host var 'tenant' contains the full API response Changes: - Added tenant_data option to DOCUMENTATION - Extended refresh_tenants_lookup() with tenants_lookup_slug - Added _add_tenant_groups() method for group creation - Excluded tenant from generic grouping loop in add_host_to_groups() - Added tenant group assignment in main()
Adds a new tenant_data boolean option (default: false) that includes full tenant data structures from the NetBox API in host vars, mirroring the existing site_data option. Changes: - Added tenant_data option to DOCUMENTATION - Extended refresh_tenants_lookup() with tenants_lookup_slug - Added _add_tenant_groups() method for group creation - Excluded tenant from generic grouping loop in add_host_to_groups() - Added tenant group assignment in main() - Added option reading in parse()
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issue
New Behavior
When
tenant_data: trueis set in the inventory configuration, the full tenant data structure from the NetBox API is included in host vars (id, name, slug, description, group, custom_fields, tags, etc.).When
tenant_data: false(default), only the tenant slug string is included — preserving current behavior.Contrast to Current Behavior
Currently, tenant host vars always contain only the slug string (e.g.
"acme-corp"), regardless of configuration. There is no way to get the full tenant object in host vars.The
site_dataoption already provides this toggle for sites. This PR adds the equivalent for tenants.Discussion: Benefits and Drawbacks
site_data, so the implementation is consistent and predictable.false, so existing behavior is unchanged.Changes to the Documentation
Plugin DOCUMENTATION string updated with the new
tenant_dataoption definition.Proposed Release Note Entry
nb_inventory - Add
tenant_dataoption to include full tenant data structures in host vars, mirroringsite_databehavior.Double Check
develbranch.