Open ypid opened 3 years ago
If I understood the netbox.netbox.nb_inventory right it is able to generate a dynamic inventory in a generic way. With your addition it would also be able to export the inventory to files.
On the other hand the netbox-joined-inventory is part of a networking stack that is able to configure switches. It can take all VLAN, VXLAN, Anycast, MLAG , BGP data and more all from netbox. Therefore netbox-joined-inventory needs to join a lot of tables from netbox. See https://github.com/Sidarion/netbox-joined-inventory data model. After all the joining netbox-joined-inventory will produce the static files that ansible can take as inventory and all details in the detailed host_vars files.
As all this joining is very specific to this networking stack I doubt that the more generic netbox.netbox.nb_inventory could replace the netbox-joined-inventory.
Right. That is the thing I was not sure about, how difficult it would be to implement your use case with the generic inventory. From the data model and the implementation it looks like explicit IPAM access is not provided by netbox.netbox.nb_inventory
. But my question would be if you really need that as the information relevant to a device is included in the inventory of that device (VLAN names, VIDs, IP addresses of the interfaces). Also custom fields of devices are included. But I don’t need an answer to that as my use case is not a complex network. I just wanted to provide input how the review can be implemented with the official inventory plugin.
Thanks again for sharing all this work!
It looks to me that this script got deprecated by https://netbox-ansible-collection.readthedocs.io/en/latest/plugins/inventory/nb_inventory/netbox.netbox.nb_inventory_inventory.html. The reason I looked into netbox-joined-inventory was that it provides a nice way to generate inventory files that one can review. I have now tested a way to get a similar behavior with
netbox.netbox.nb_inventory
:ansible/inventory/netbox.yml
:ansible/refresh-netbox.yml
:ansible.cfg
:Makefile
:To refresh the cache, run
ansible-inventory -v --list -i ansible/refresh-netbox.yml
and then review the changes in~/.ansible/inventory_cache
ormake refresh-netbox
.You could also use
ansible-playbook --diff --check
in combination with manual cache refresh.What do you think?