community / community.vmware / 0.4.0 / module / vmware_dvs_portgroup_find Find portgroup(s) in a VMware environment Authors: David Martinez (@dx0xm) preview | supported by communitycommunity.vmware.vmware_dvs_portgroup_find (0.4.0) — module
Install with ansible-galaxy collection install community.vmware:==0.4.0
collections: - name: community.vmware version: 0.4.0
Find portgroup(s) based on different criteria such as distributed vSwitch, VLAN id or a string in the name.
- name: Get all portgroups in dvswitch vDS vmware_dvs_portgroup_find: hostname: "{{ vcenter_hostname }}" username: "{{ vcenter_username }}" password: "{{ vcenter_password }}" dvswitch: 'vDS' validate_certs: no delegate_to: localhost
- name: Confirm if vlan 15 is present vmware_dvs_portgroup_find: hostname: "{{ vcenter_hostname }}" username: "{{ vcenter_username }}" password: "{{ vcenter_password }}" vlanid: '15' validate_certs: no delegate_to: localhost
name: description: - string to check inside the name of the portgroup. - Basic containment check using python C(in) operation. type: str port: default: 443 description: - The port number of the vSphere vCenter or ESXi server. - If the value is not specified in the task, the value of environment variable C(VMWARE_PORT) will be used instead. - Environment variable support added in Ansible 2.6. type: int vlanid: description: - VLAN id can be any number between 1 and 4094. - This search criteria will looks into VLAN ranges to find possible matches. required: false type: int dvswitch: description: - Name of a distributed vSwitch to look for. type: str hostname: description: - The hostname or IP address of the vSphere vCenter or ESXi server. - If the value is not specified in the task, the value of environment variable C(VMWARE_HOST) will be used instead. - Environment variable support added in Ansible 2.6. type: str password: aliases: - pass - pwd description: - The password of the vSphere vCenter or ESXi server. - If the value is not specified in the task, the value of environment variable C(VMWARE_PASSWORD) will be used instead. - Environment variable support added in Ansible 2.6. type: str username: aliases: - admin - user description: - The username of the vSphere vCenter or ESXi server. - If the value is not specified in the task, the value of environment variable C(VMWARE_USER) will be used instead. - Environment variable support added in Ansible 2.6. type: str proxy_host: description: - Address of a proxy that will receive all HTTPS requests and relay them. - The format is a hostname or a IP. - If the value is not specified in the task, the value of environment variable C(VMWARE_PROXY_HOST) will be used instead. - This feature depends on a version of pyvmomi greater than v6.7.1.2018.12 required: false type: str proxy_port: description: - Port of the HTTP proxy that will receive all HTTPS requests and relay them. - If the value is not specified in the task, the value of environment variable C(VMWARE_PROXY_PORT) will be used instead. required: false type: int show_uplink: default: false description: - Show or hide uplink portgroups. - Only relevant when C(vlanid) is supplied. type: bool validate_certs: default: true description: - Allows connection when SSL certificates are not valid. Set to C(false) when certificates are not trusted. - If the value is not specified in the task, the value of environment variable C(VMWARE_VALIDATE_CERTS) will be used instead. - Environment variable support added in Ansible 2.6. - If set to C(yes), please make sure Python >= 2.7.9 is installed on the given machine. type: bool
dvs_portgroups: description: basic details of portgroups found returned: on success sample: - dvswitch: vDS name: N-51 pvlan: true trunk: true vlan_id: '0' type: list