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

[Feature Request] Add VM and Machine Tags to IPs and NICs #297

Open
fzumpe opened this issue Apr 19, 2023 · 7 comments
Open

[Feature Request] Add VM and Machine Tags to IPs and NICs #297

fzumpe opened this issue Apr 19, 2023 · 7 comments
Labels
awaiting reply Awaiting reply from issue owner

Comments

@fzumpe
Copy link

fzumpe commented Apr 19, 2023

For an automation purpose it would be quite convinient to add Tags from vphere VMs to IPs attached to them to specify for example DEV- and PROD-Environments, Customers etc.
The Sourcecode explicitly forbits importing tags for other objects than machines, clusters, folders and so on. Is it possible to enlarge configuration options with options like "ip_tag_source = object, vm" etc?

;cluster_tag_source =
;host_tag_source =
;vm_tag_source =

@fzumpe fzumpe changed the title [Feture Request] Add VM and Machine Tags to IPs and NICs [Feature Request] Add VM and Machine Tags to IPs and NICs Apr 19, 2023
@bb-Ricardo
Copy link
Owner

Hi,

so far i'm not aware that IP addresses are objects in vmware where we can grab it from.

@fzumpe
Copy link
Author

fzumpe commented Apr 19, 2023

The IPs associated to the VM are already pulled out of the vsphere vcenter alongside with all NICs and other hardware.
While iterating over the dependend objects the tags of the IPs can be set as you do with the tags of the VM.

In module/sources/vmware/connection.py Line 2242 you iterate over the IPs associated to vm nics and add them to the collection of nic_ips which you add to the inventory in 2364.
Additional to the ip/cidr entry, the tag attribute of the VM / Folders / Cluster ... can be added to the variable nic_ips.

@bb-Ricardo
Copy link
Owner

It sounds like you know how to retrieve the data, I would be quite happy a PR.

@bb-Ricardo
Copy link
Owner

I might have misunderstood your question.

So you would like to assign the same tags which were retrieved from the vCenter for the Host/VM to the IP and network interfaces? is that correct?

Adding tags should not be that big of a deal but if an IP moves it is quite difficult to remove the old tags from the previous machine as the relation is already lost.

what do you think?

@bb-Ricardo bb-Ricardo added the awaiting reply Awaiting reply from issue owner label Apr 19, 2023
@fzumpe
Copy link
Author

fzumpe commented Apr 19, 2023 via email

@bb-Ricardo
Copy link
Owner

This is unfortunately not easy to realise as it seems. It depends in which order the vCenter lists the VMs.
Also it is not clear which Tags are added manually in NetBox and which Tags are imported from vCenter. Only the vCenter tags should be removed.

What would be your approach?

@bb-Ricardo
Copy link
Owner

Hey,

just wanted to check if this is still relevant and if so, do you have an approach how to solve the described issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting reply Awaiting reply from issue owner
Projects
None yet
Development

No branches or pull requests

2 participants