Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add is_virtual attribute #28

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

devon-mar
Copy link
Contributor

This PR adds the is_virtual attribute to the host's data attributes to differentiate between VMs and devices.

@wvandeun
Copy link
Owner

wvandeun commented May 10, 2021

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?!

@devon-mar
Copy link
Contributor Author

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.

@wvandeun wvandeun force-pushed the develop branch 2 times, most recently from f603f61 to 1abc7e6 Compare November 17, 2021 23:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants