netbox-sync icon indicating copy to clipboard operation
netbox-sync copied to clipboard

Add a domain name if not present in a vm's name

Open eric-eisenhart opened this issue 2 years ago • 3 comments

Tested and works for me...

Purpose explained in #355

Two new params. Intended to handle these types of things:

  • shortname -> shortname.example.com (add domain)
  • foo.site1 -> foo.site1.example.com (add domain)
  • foo.site2.example.com -> foo.site2.example.com (no change)
  • foobar.example.net -> foobar.example.net

For when names in vCenter have an implied domain if not included.

eric-eisenhart avatar Nov 03 '23 23:11 eric-eisenhart

Hi,

This would be a great addition. I'm afraid that it would not cover the case where one would only assign a missing domain to certain VMs. Could you change it to work the same way as existing relations?

bb-Ricardo avatar Nov 08 '23 16:11 bb-Ricardo

You mean something like this?

vm_domain_name_relation = ^[a-z]\.foo$ = example.net, ^[a-z]-bar$ = example.com

Replacing simple add_vm_domain_name with:

vm_domain_name_relation = .* = example.net

Should that still have the keep_vm_domain_name_filter regex param to skip things that already have a domain name on them?

eric-eisenhart avatar Nov 09 '23 23:11 eric-eisenhart

Sorry @eric-eisenhart I missed your comment.

the first example looks good to me. Would need to craft your config precisely. And if the relation matches but the correct domain name is already part of the VM name then it would not add the domain name again.

What do you think?

bb-Ricardo avatar Dec 22 '23 09:12 bb-Ricardo