Open kcbark opened 4 years ago
I gave this a try myself. @kcbark, could you try it out to see if this is what you were thinking? See here for the code: https://github.com/nahun/ansible_modules/blob/vc-members/plugins/inventory/nb_inventory.py.
Add the virtual_chassis_members: true
option to your inventory file.
If its good, I'll fix the tests and create a PR.
Nice!
I almost forgot about this. I had a local patch as well but forgot to publish it.
I will test and get back to you.
Thanks!
Any update on this from either of y'all?
And Merry Christmas by the way! Obviously I'm sure y'all are busy with family stuff, but once the holidays are over with, let me know how this is going for y'all.
Happy Holidays!
I need to rebase my branch and get the pieces for testing added. I'll create a PR when ready.
Just FYI, the way I'm implementing this is another data lookup for all devices that are VC members (virtual_chassis_member=true
filter). Since the user might be filtering the devices list, we can't depend on that existing lookup to get all VC members.
I'd make sure to only do that extra call if query_filters
is specified to address your point of it being filtered and missing things.
Thanks for your incoming work on this!
I stumbled upon this issue when I setup some existing firewalls in netbox to join a virtual cluster. IE firewall-a
& firewall-b
are now members of the firewall
cluster.
I would normally handle these devices as 1 given normal cluster behavior, BUT in terms of backup or reboot workflows, its important that the netbox inventory handle these as 2 different devices. I mean the API returns them as 2 different devices. I believe that overall virtual_clusters should be handled better.
IE I think for completeness the following flags should be supported(some already are):
virtual_chassis_name
- As already supported, returns just the master name and not the physical chassis namesvirtual_chassis_members
- As per this thread provide chassis members when combined with virtual_chassis_name
is setvirtual_chassis_non_masters
- Brand new feature, assuming the virtual_chassis_name
& virtual_chassis_members
are not set, returns the devices as you would see in a normal API query, IE none of this only returning the master device would continue.
ISSUE TYPE
SOFTWARE VERSIONS
Ansible:
2.9.13
Netbox:
2.9.7
Collection:
v1.0.0
SUMMARY
We need a way to populate virtual chassis members properties via playbook. But since virtual chassi members are excluded by the inventory we are unable to.
STEPS TO REPRODUCE
ansible-inventory -i inventory/netbox.yml --list does not list virtual chassi members.
EXPECTED RESULTS
Add a toggle for including virtual chassis when asking for devices from netbox as inventory.
ACTUAL RESULTS
Virtual chassi members are not included when asking for devices from netbox as inventory.