bb-Ricardo / netbox-sync

Sync objects from VMware or redfish sources to NetBox
MIT License
286 stars 65 forks source link

Multisite VCenter issue #421

Open LooPep opened 1 week ago

LooPep commented 1 week ago

Hey,

We have two IT infrastructures (let's say IT1 and IT2) on two differents sites (distinct perimeters), using different VCenters. Netbox-sync is already running (working good) on IT1 and connected to our unique Netbox instance (v3.7.4), and I want to run a new Netbox-sync on IT2.

The problem is, when running Netbox-sync on IT2 with it's own 'settings.ini' config file with 'permitted_subnets' correctly configured, all of the IT1 perimeter is getting overwrite and all of the IT1 VM's are getting 'Orphaned' Tag.

It seems that IT2 Netbox-sync ignores it's 'permitted_subnets' flag and is editing all of the items registered in Netbox.

IT2 Netbox-sync config sample :

[source/otpo1]

# Defines if this source is enabled or not
enabled = True

# type of source. This defines which source handler to use.
# Currently supported
#   * vmware    : VMWare vcenter
type = vmware

# host name / IP address of the vCenter
host_fqdn = 172.17.*.*

# TCP port to connect to
port = 443

# username and password to use to log into vCenter
username = ***************
password = **************

permitted_subnets = 172.17.0.0/16

cluster_site_relation = .* = Multisite EU-PO
cluster_tenant_relation = .* = INFRA-IT2
host_role_relation = .* = ESXi
vm_role_relation = .* = VMserver

collect_hardware_asset_tag = True

dns_name_lookup = True

# Do not sync notes from a VM in vCenter to the comments field on a VM in netbox
skip_vm_comments = False

# Do not sync template VMs
skip_vm_templates = True

# sync custom attributes defined for hosts and VMs in vCenter to NetBox as custom fields
#sync_custom_attributes = False
sync_custom_attributes = True

; enabling this option will add the ESXi host this VM is running on to the VM details
track_vm_host = True
bb-Ricardo commented 1 week ago

Hi,

Just configure both vCenter instances in the same config file and run the sync. Then it should work properly.