--- # ============================================================================= # Production Environment - NetBox CMDB Dynamic Inventory (EXAMPLE) # ============================================================================= # # This is an example configuration for NetBox dynamic inventory. # Rename to netbox.yml and configure with your NetBox instance details. # # Requirements: # ansible-galaxy collection install netbox.netbox # # Usage: # ansible-inventory -i inventories/production/netbox.yml --list # # ============================================================================= plugin: netbox.netbox.nb_inventory # NetBox API Configuration api_endpoint: https://netbox.example.com token: "{{ lookup('env', 'NETBOX_TOKEN') }}" # Use environment variable # OR use vault: # token: "{{ vault_netbox_api_token }}" # Validate SSL certificate validate_certs: true # Device filters config_context: false group_by: - device_roles - sites - platforms - tags # Query filters query_filters: - site: production - status: active # Group prefix group_names_raw: false # Compose host variables compose: ansible_host: primary_ip4 environment: production netbox_site: site.name netbox_role: device_role.name # Keyed groups keyed_groups: - key: device_role.name prefix: role - key: site.name prefix: site - key: platform.name prefix: platform # Virtual machines virtual_machines: true # Interfaces interfaces: true