bb-Ricardo / netbox-sync

Sync objects from VMware or redfish sources to NetBox
MIT License
276 stars 62 forks source link

linking vms to ipam module #336

Open sharkless opened 1 year ago

sharkless commented 1 year ago

I noticed that after I got and IP address tied to a vm and when the sync runs it wipes all that out. I dont know if that is because it is recreating the vms or if the sync just wipes out that data. Is there a way to stop this from happening?

bb-Ricardo commented 1 year ago

Can you please describe of what you are doing in NetBox with linking the IPAM module? Haven't done that before.

sharkless commented 1 year ago

Under the IPAM module you can go into an IP address and then Interface Assignment and attach that IP address to a VM. I am using it for our public IPs so I can link it to an internal NAT and what server that NAT is tied to. But seems when the sync happens it will wipe out that assignment.

kamils85 commented 1 year ago

I believe this is the same issue I am facing. I have few VMs that cannot run vm-tools and they won't expose the IP addresses to the hypervisor. If I manually assign the IP address as @sharkless mentioned the next time the script runs it overrides the data and de-assign the IP address.

2023-08-29 07:41:42,345 - INFO: IP address is no longer assigned to vNIC 1 (vlan23) (mms.somedomain.com) and therefore removed from this interface
2023-08-29 07:41:42,345 - INFO: Setting attribute 'primary_ip4' for 'mms.somedomain.com' to None
2023-08-29 07:41:42,345 - INFO: Setting attribute 'assigned_object_id' for '1.1.1.18/30' to None
2023-08-29 07:41:42,346 - INFO: Setting attribute 'assigned_object_type' for '1.1.1.18/30' to None
2023-08-29 07:41:42,987 - INFO: IP address is no longer assigned to vNIC 1 (vlan23) (sip.somedomain.com) and therefore removed from this interface
2023-08-29 07:41:42,988 - INFO: Setting attribute 'primary_ip4' for 'sip.somedomain.com' to None
2023-08-29 07:41:42,988 - INFO: Setting attribute 'assigned_object_id' for '1.1.1.22/30' to None
2023-08-29 07:41:42,991 - INFO: Setting attribute 'assigned_object_type' for '1.1.1.22/30' to None
2023-08-29 07:41:48,135 - INFO: Parsing objects which were marked to be reevaluated
2023-08-29 07:41:48,199 - INFO: Updating changed data in NetBox
2023-08-29 07:41:48,200 - INFO: Updating NetBox 'virtual machine' object 'mms.somedomain.com' with data: {'primary_ip4': None}
2023-08-29 07:41:48,813 - INFO: Updating NetBox 'virtual machine' object 'sip.somedomain.com ' with data: {'primary_ip4': None}
2023-08-29 07:41:49,452 - INFO: Updating NetBox 'IP address' object '1.1.1.18/30' with data: {'assigned_object_id': None, 'assigned_object_type': None}
2023-08-29 07:41:49,519 - INFO: Updating NetBox 'IP address' object '1.1.1.22/30' with data: {'assigned_object_id': None, 'assigned_object_type': None}

I would be good to have the option to exclude specific hosts from auto-assigning the IP address.

kamils85 commented 1 year ago

Apologies, just noticed this was already mentioned in #326.

sharkless commented 1 year ago

I think even the vms that have vmtools on them lost this information on the sync. But I have not tried it as I have put a lot of work into linking everything. I could do a snap if you want me to and test if it is only vms without tools or all.

Sent from iPhone, please excuse any brevity or typing errors.


From: Kamil @.> Sent: Tuesday, August 29, 2023 5:40:38 AM To: bb-Ricardo/netbox-sync @.> Cc: Scott Harkless @.>; Mention @.> Subject: Re: [bb-Ricardo/netbox-sync] linking vms to ipam module (Issue #336)

WARNING:

This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.

I believe this is the same issue I am facing. I have few VMs that cannot run vm-tools and they won't expose the IP addresses to the hypervisor. If I manually assign the IP address as @sharklesshttps://github.com/sharkless mentioned the next time the script runs it overrides the data and de-assign the IP address.

2023-08-29 07:41:42,345 - INFO: IP address is no longer assigned to vNIC 1 (vlan23) (mms.somedomain.com) and therefore removed from this interface 2023-08-29 07:41:42,345 - INFO: Setting attribute 'primary_ip4' for 'mms.somedomain.com' to None 2023-08-29 07:41:42,345 - INFO: Setting attribute 'assigned_object_id' for '1.1.1.18/30' to None 2023-08-29 07:41:42,346 - INFO: Setting attribute 'assigned_object_type' for '1.1.1.18/30' to None 2023-08-29 07:41:42,987 - INFO: IP address is no longer assigned to vNIC 1 (vlan23) (sip.somedomain.com) and therefore removed from this interface 2023-08-29 07:41:42,988 - INFO: Setting attribute 'primary_ip4' for 'sip.somedomain.com' to None 2023-08-29 07:41:42,988 - INFO: Setting attribute 'assigned_object_id' for '1.1.1.22/30' to None 2023-08-29 07:41:42,991 - INFO: Setting attribute 'assigned_object_type' for '1.1.1.22/30' to None 2023-08-29 07:41:48,135 - INFO: Parsing objects which were marked to be reevaluated 2023-08-29 07:41:48,199 - INFO: Updating changed data in NetBox 2023-08-29 07:41:48,200 - INFO: Updating NetBox 'virtual machine' object 'mms.somedomain.com' with data: {'primary_ip4': None} 2023-08-29 07:41:48,813 - INFO: Updating NetBox 'virtual machine' object 'sip.somedomain.com ' with data: {'primary_ip4': None} 2023-08-29 07:41:49,452 - INFO: Updating NetBox 'IP address' object '1.1.1.18/30' with data: {'assigned_object_id': None, 'assigned_object_type': None} 2023-08-29 07:41:49,519 - INFO: Updating NetBox 'IP address' object '1.1.1.22/30' with data: {'assigned_object_id': None, 'assigned_object_type': None}

I would be good to have the option to exclude specific hosts from auto-assigning the IP address.

— Reply to this email directly, view it on GitHubhttps://github.com/bb-Ricardo/netbox-sync/issues/336#issuecomment-1697104747, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AHCJSJDE4PRIHWA5AL6JHB3XXW2JNANCNFSM6AAAAAA3PVGWNM. You are receiving this because you were mentioned.Message ID: @.***>

-=-=-=-=-=-=-=-=-=- Scott Harkless @.***) Operations Team Lead Health Care Logistics Work: 800-848-1633 xx4505 Cell: +1 6142043746 DID: 614.853.6775 http://gohcl.com [http://shop.gohcl.com/EmailChicken.gif]

Follow HCL now on Twitterhttp://twitter.com/HCLinc and Facebookhttp://www.facebook.com/healthcarelogistics!