Tracking IPs, networks, servers, and virtual machines manually in Excel and Confluence creates an airgap that prevents seamless automation. I shared our journey to bridge this gap during my talk at the 10th Ansible Meetup in Zurich. As we pushed for wider adoption of configuration management, we realized we needed a robust source of truth inventory, leading us to migrate to Netbox for IPAM and device management. Here is a breakdown of how Netbox and Ansible integrate, how context data is structured, and why we sometimes have to bypass modules to interact directly with the API.

Netbox: The Source of Truth
Netbox is an open-source infrastructure resource modeling application that serves as a unified source of truth. It manages IP address management (IPAM), tracking networks, VRFs, and VLANs. Beyond IPs, it natively maps the physical and virtual world, including equipment racks, device types, virtualization clusters, data circuits, and the specific power or console connections between them.
Its popularity stems from its robust REST API and its ability to act as a dynamic inventory for configuration management. Using the netbox.netbox.nb_inventory plugin, Ansible can automatically group devices by attributes like device_roles or tags, and filter them (e.g., has_primary_ip: true) directly from the Netbox database.
Demo & Source Code
During the session, I showcased a practical example of how we structured our yaml dataset and the use of ansible.builtin.uri module to interact with Netbox.
You can find the complete code to replicate the setup in the repository:
Ansible Netbox Meetup Repository on GitLab
Download Presentation Slides