bb-Ricardo/netbox-sync

Ignore guest os after initial seed

lwhitworth opened this issue · 6 comments

We run a lot of Ubuntu VMs and would like to have them separated in Netbox by version as their platform, however when we run sync it takes the good old vmware default of "Ubuntu Linux (64-Bit)".

image

We have an ansible script that will change the platform for the hosts back, but the next time sync runs it will set it back to "Ubuntu Linux (64-Bit)".

Is there some way to add logic to say not to overwrite platform after initial creation? Or something smarter I'm missing?

@gstorme I looked into that, but that wouldn't help I don't think, as vmware is only ever going to return "Ubuntu Linux (64-Bit)" no matter the version, so I can't see how you'd then split that down further.......

Hey @lwhitworth

So you pretty much need an option to not overwrite the VM platform if it's already defined?

Unfortunately we rely on thw VMWare tools to provide the VM OS name and it seems like that's to much to ask to read info on that from /etc/os-release.

Should be not to difficult to add an option to avoid overwriting the platform. Currently it's more difficult to find the time to work on it.

Yeah that's pretty much the long and the short of it cheers. I have a workaround for now, so not hugely urgent.

Hi @lwhitworth,

I just pushed a commit with two new config options to the development branch:

diff --git a/settings-example.ini b/settings-example.ini
index d00fb4f..cebe456 100644
--- a/settings-example.ini
+++ b/settings-example.ini
@@ -344,6 +344,13 @@ password = super-secret
 ; NetBox. The interface will only be matched by identical MAC address
 ;overwrite_vm_interface_name = True

+; define if the platform of the device discovered overwrites the device platform in
+; NetBox.
+;overwrite_device_platform = True
+
+; define if the platform of the VM discovered overwrites the VM platform in NetBox.
+;overwrite_vm_platform = True
+
 ; set a matching value for ESXi host management interface description (case insensitive,
 ; comma separated). Used to figure out the ESXi primary IP address
 ;host_management_interface_match = management, mgmt

Can you have a look at it and test it. If it works you are free to close this issue as resolved.

Thank you

My man! Great stuff, works perfectly. Much appreciated.