Open devon-mar opened 3 years ago
Can you elaborate a bit more on your use case?
If you apply a different role and/or platform to your VirtualMachines compared to your devices, then you should be able to easily distinguish between them in Nornir's perspective based on those attributes?
In my opinion that would be the proper / right way to do this, as this the more generic solution. But I could be wrong?!
In my case, I have some virtual and physical routers that hold the same roles. I'm using pynetbox in my runbook to gather other data about the device (interfaces, IPs, secrets) and the query filters for VMs and devices are different so I need some way to differentiate between the two. Also, when creating secrets, assigned_object_type
needs to specified.
While I could assign different roles to VMs/devices, it would complicate some other things (config context assignments, reports) and it would mean I would have to keep and maintain a list of VM roles in my runbooks/templates.
The Ansible nb_inventory
module has a similar feature where it adds is_virtual
to the host data.
This PR adds the
is_virtual
attribute to the host's data attributes to differentiate between VMs and devices.