diff --git a/lib/ansible/module_utils/vmware.py b/lib/ansible/module_utils/vmware.py index a0999c0544..9950cdd937 100644 --- a/lib/ansible/module_utils/vmware.py +++ b/lib/ansible/module_utils/vmware.py @@ -108,6 +108,14 @@ def find_vm_by_name(content, vm_name): return None +def find_host_portgroup_by_name(host, portgroup_name): + + for portgroup in host.config.network.portgroup: + if portgroup.spec.name == portgroup_name: + return portgroup + return None + + def vmware_argument_spec(): return dict(