diff --git a/changelogs/fragments/vmware-only-add-configured-interfaces.yml b/changelogs/fragments/vmware-only-add-configured-interfaces.yml new file mode 100644 index 0000000000..903d757849 --- /dev/null +++ b/changelogs/fragments/vmware-only-add-configured-interfaces.yml @@ -0,0 +1,2 @@ +minor_changes: + - vmware.py - Only add configured network interfaces to facts. diff --git a/lib/ansible/module_utils/vmware.py b/lib/ansible/module_utils/vmware.py index 5b88cab32e..f6c1d1b702 100644 --- a/lib/ansible/module_utils/vmware.py +++ b/lib/ansible/module_utils/vmware.py @@ -365,7 +365,8 @@ def gather_vm_facts(content, vm): vmnet = _get_vm_prop(vm, ('guest', 'net')) if vmnet: for device in vmnet: - net_dict[device.macAddress] = list(device.ipAddress) + if device.deviceConfigId > 0: + net_dict[device.macAddress] = list(device.ipAddress) if vm.guest.ipAddress: if ':' in vm.guest.ipAddress: