bb-Ricardo/netbox-sync

Feature Request: Add domain name if not already there

eric-eisenhart opened this issue · 2 comments

In netbox, we have everything as foo1.example.com and foo2.example.net, but in vcenter we have a mix of "foo1.example.com", "foo2.example.net" and "foo3" (.example.net implied).

Part of the issue is that there's various bits of automation tied to the netbox data, so renaming a VM from "foo2.example.net" to "foo2" could cause problems with other systems, make it harder for other automation to correlate hosts to netbox entries, etc... And renaming everything in vCenter is a huge pain...

So, basically, I want a "add example.net" config and a regex like .*example\.(com|net)$ or list like example.com, example.net to change these vcenter VM hostnames to these netbox names:

  • foo1 -> foo1.example.net
  • foo1.site1 -> foo1.site1.example.net
  • foo1.site2 -> foo1.site2.example.net
  • foo2.example.net -> foo2.example.net
  • foo3.example.com -> foo3.example.com

Theoretically the same concept could apply to ESX hosts, but there's quite a bit fewer of those and a lot less automation tied to their netbox entries. (also we already have all of them in vCenter with FQDNs)

First pass at code for this in #356

Added a comment to your PR