Open SteveRodrigue opened 2 years ago
Maybe this will help others. Here is my current workaround.
I created a "mini-role" that only does this:
api/dcim/interfaces/?device=member&limit=0
).
2b. I merge interfaces
with the register.json.results
of 2a.interfaces
.Would also love to see this functionality. We have several switch stacks which are modeled as a virtual chassis, and right now there's no easy way to deploy the complete interface configuration in one go, e.g. via the Ansible Cisco IOS roles.
@SteveRodrigue Would you be willing to share the code of your "mini-role"?
Would also love to see this functionality. We have several switch stacks which are modeled as a virtual chassis, and right now there's no easy way to deploy the complete interface configuration in one go, e.g. via the Ansible Cisco IOS roles.
@SteveRodrigue Would you be willing to share the code of your "mini-role"?
@hoalex Sharing the exact role would be a bit complicated. But here is the abstracted logic...
My current not optimal logic is:
api/dcim/devices/?name={{ inventory_hostname }}
api/dcim/devices/?virtual_chassis_id=XXXX
api/dcim/interfaces/?limit=0&device=xxxx
4b. I simply merge all interfaces together into the master chassis. interfaces: {{ interfaces + member.interfaces }}
To be honest, a streamlined logic would be this:
api/dcim/interfaces/?limit=0&virtual_chassis_id=XXX
interfaces
variable with the list of interfaces found in step 2.
NetBox version
v2.11.6
Feature type
Change to existing Module
Proposed functionality
Setting a boolean to true should have the nb_inventory module to pull all interfaces from a device (master + child chassis from a virtual-chassis member).
At the moment, only direct interfaces are fetched when pulling interfaces information using nb_inventory.
Pseudo-code logic:
if host is member of a virtual-chassis and virtual_chassis_all_interfaces == true then combine interfaces of all virtual-chassis members return the combined interfaces list
Use case
When doing automation of network equipment, we always target the "master/primary" chassis and all members interfaces are configured/checked through this master chassis.
We almost never target a child chassis.
Also, this change in behaviour would reproduce the Web GUI interface. In the web version of Netbox, the master/primary chassis contains all interfaces of the virtual-chassis, so we can easily see and edit information from that single view. When using the Ansible module, we can't do the same (behaviour is not consistent).
External dependencies
None that I can think of.