Files
alexpolo1 a3b8959ca9 Initial collection structure
Migrated from legacy playbook repo into Ansible collection format:

Roles (171 total):
- common: 44 roles (fact gathering, SSH setup, utilities)
- configuration: 32 roles (system config, networking, satellite)
- provisioning: 16 roles (VMware, Azure, physical server deployment)
- security: 15 roles (OpenSCAP hardening, certificates, AD integration)
- monitoring: 12 roles (Zabbix, logging agents, metrics)
- networking: 12 roles (DNS, DHCP, network interfaces)
- satellite: 4 roles (Pulp/Satellite management)
- misc: 36 roles (various utilities)

Playbooks (159 total):
- provisioning: 14 playbooks
- azure: 13 playbooks
- configuration: 22 playbooks
- maintenance: 10 playbooks
- security: 10 playbooks
- monitoring: 9 playbooks
- vcenter: 6 playbooks
- networking: 7 playbooks
- misc: 65 playbooks
2026-06-27 21:48:22 +02:00
..
2026-06-27 21:48:22 +02:00
2026-06-27 21:48:22 +02:00
2026-06-27 21:48:22 +02:00

set-netbox-tag

This role sets tags on virtual machines in NetBox.

Requirements

  • netbox.netbox collection installed
  • NETBOX_API and NETBOX_TOKEN environment variables or variables set

Role Variables

  • netbox_tags: List of tags to add to the virtual machine (default: [])

Available Tags

The following tags are available in your NetBox instance:

  • 732 - VM size/identifier
  • TAPI - TAPI systems
  • ansibleaccess - Ansible management access enabled
  • automation - Automated deployment
  • azure-sync - Azure synchronized
  • EXAMPLE-CORP.COM - CCTA domain systems
  • DMZ23.EXAMPLE.COM - DMZ zone 23
  • DMZ.EXAMPLE.COM - DMZ zone 24
  • itsm - ITSM managed systems
  • large-vm - Large virtual machine
  • medium-vm - Medium virtual machine
  • noansibleaccess - No Ansible access
  • notinsatellite - Not in satellite
  • satellite - Satellite managed
  • small-vm - Small virtual machine
  • vmware-auto-updated - VMware auto-updated

To see all available tags, run:

curl -H "Authorization: Token YOUR_TOKEN" https://netbox.example.EXAMPLE-CORP.COM/api/extras/tags/ -k | jq '.results[] | {name, slug}'

Example Playbook

- hosts: servers
  roles:
    - role: set-netbox-tag

Usage with NetBox inventory and limit:

# Set environment variable for NetBox token
export NETBOX_TOKEN="your-netbox-api-token"

# Add tags to specific hosts (with vault password for inventory)
ansible-playbook set-netbox-tags.yml -i netbox.yml --limit "hostname.EXAMPLE-CORP.COM" -e '{"netbox_tags":["satellite","EXAMPLE-CORP.COM"]}' --ask-vault-pass

# Add tags to multiple hosts
ansible-playbook set-netbox-tags.yml -i netbox.yml --limit "*.EXAMPLE-CORP.COM" -e '{"netbox_tags":["production"]}' --ask-vault-pass

Note: Use JSON format -e '{"netbox_tags":["tag1","tag2"]}' to pass the tags list properly.

License

GPL-2.0-or-later