diff --git a/plugins/modules/vmware_guest.py b/plugins/modules/vmware_guest.py index 864a8dfc7..ff386e4ef 100644 --- a/plugins/modules/vmware_guest.py +++ b/plugins/modules/vmware_guest.py @@ -1940,7 +1940,12 @@ def configure_network(self, vm_obj): nic.device.deviceInfo.summary = network_name nic_change_detected = True else: - pg = find_obj(self.content, [vim.DistributedVirtualPortgroup], network_name) + pgs = self.find_network_by_name(network_name) + if len(pgs) == 1: + pg = pgs[0] + else: + pg = find_obj(self.content, [vim.DistributedVirtualPortgroup], network_name) + if pg is None or nic.device.backing.port.portgroupKey != pg.key: nic.device.deviceInfo.summary = network_name nic_change_detected = True