Skip to content

Add tenant field support to netbox_vlan_group#1518

Merged
sc68cal merged 5 commits intodevelfrom
feature/add-tenant-to-vlan-group
Feb 1, 2026
Merged

Add tenant field support to netbox_vlan_group#1518
sc68cal merged 5 commits intodevelfrom
feature/add-tenant-to-vlan-group

Conversation

@richbibby
Copy link
Contributor

Related Issue

#1446

New Behavior

The netbox_vlan_group module now supports the tenant field, allowing users to assign VLAN groups to specific tenants in NetBox.

Users can now specify a tenant when creating or updating VLAN groups:

- name: Create vlan group with tenant assignment
  netbox_vlan_group:
    netbox_url: http://netbox.local
    netbox_token: thisIsMyToken
    data:
      name: Test vlan group
      scope_type: "dcim.site"
      scope: Test Site
      tenant: Test Tenant
    state: present

Contrast to Current Behavior

Previously, the netbox_vlan_group module did not support the tenant field, making it impossible to assign VLAN groups to tenants through Ansible automation. Users had to manually set tenants in the NetBox UI or use the API directly.

Discussion: Benefits and Drawbacks

Benefits:

  • Enables full automation of VLAN group tenant assignments via Ansible
  • Brings the module to feature parity with NetBox's VLAN group API capabilities
  • Maintains consistency with other modules in the collection that support tenant fields
  • Allows for better multi-tenant network automation workflows

Drawbacks:

  • None identified

Backwards Compatibility:

  • Fully backwards compatible - the tenant field is optional and existing playbooks will continue to work without modification

Changes to the Documentation

  • Added tenant field documentation to the module's argument spec
  • Added example demonstrating tenant assignment usage
  • Added changelog fragment for release notes (will appear in next release)

Proposed Release Note Entry

netbox_vlan_group - Add tenant field support (#1446)

Double Check

  • I have read the comments and followed the CONTRIBUTING.md.
  • I have explained my PR according to the information in the comments or in a linked issue.
  • My PR targets the devel branch.

richbibby and others added 5 commits January 31, 2026 17:39
Adds tenant parameter to netbox_vlan_group module to support the tenant
field added in NetBox 4.3+ (netbox-community/netbox#18690).

NetBox Version Requirement:
- Requires NetBox 4.3 or higher
- Tested against NetBox 4.3 per existing CI matrix
- Backward compatible with NetBox 4.4+ (not yet in CI test matrix)

Changes:
- Added tenant parameter to module DOCUMENTATION and argument_spec
- Added example showing tenant usage in EXAMPLES section
- Added comprehensive integration tests for tenant field in v4.3 target:
  * Test creating VLAN group with tenant
  * Test idempotency with tenant
  * Test updating tenant value
  * Test deletion of VLAN group with tenant

Testing:
- All 228 unit tests pass ✅
- Code formatted with black ✅
- Tenant functionality verified against NetBox 4.3 ✅
- Infrastructure for tenant field already exists in netbox_utils.py

Fixes #1446

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
NetBox API returns tenant as an ID (integer) in responses, not as an
expanded object. Updated test assertions to check tenant == 1 instead
of tenant['name'] == 'Test Tenant' to match the pattern used in other
integration tests.
Adds a second tenant to test data to support tenant update
testing in netbox_vlan_group integration tests.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Documents the addition of tenant field support to netbox_vlan_group
module in the changelog for the next release.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add GitHub issue URL to changelog fragment following
project convention of including full issue URLs.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@sc68cal sc68cal merged commit 1608cf5 into devel Feb 1, 2026
68 checks passed
@sc68cal sc68cal deleted the feature/add-tenant-to-vlan-group branch February 1, 2026 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants