I'm using the community edition of Netbox to document all my IPAM (IP-Address-Management), DNS and general infrastructure. The long-term goal is to deploy as much of the configuration from Netbox to reality through different means.

The first Configuration via Netbox should be my Bind9 DNS-Server, where I deploy it via Ansible. For that Ansible uses the Netbox-Plugin to fill the dynamic inventory. Many guides simply paste the sample inventory without any explanation and show how to run it.

plugin: netbox.netbox.nb_inventory
validate_certs: true
group_by:
  - device_roles
  - sites

I created a readonly API-Key. The Netbox-Url and Key are set via the Environment variables NETBOX_TOKEN and NETBOX_API for the URL, like https://netbox.homelab.internal. The inventory can me checked with ansible-inventory --list -i netbox_inv.yaml and uses the environment variables for accessing the instance.

To further inspect all the data provided by the netbox-inventory use ansible-inventory -i netbox_inv.yml --host <hostname>. Any more informations have to be registered as variables through api-calls via ansible.

I'm also using config contexts in Netbox. By default the ansible inventory plugin only shows local context configs. For my config contexts to show up in the inventory config_context: true needs to be set in the inventory-configuration.