community.vmware.vmware_dvs_portgroup_find (4.2.0) — module

Find portgroup(s) in a VMware environment

Authors: David Martinez (@dx0xm)

Install collection

Install with ansible-galaxy collection install community.vmware:==4.2.0


Add to requirements.yml

  collections:
    - name: community.vmware
      version: 4.2.0

Description

Find portgroup(s) based on different criteria such as distributed vSwitch, VLAN id or a string in the name.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Get all portgroups in dvswitch vDS
  community.vmware.vmware_dvs_portgroup_find:
    hostname: "{{ vcenter_hostname }}"
    username: "{{ vcenter_username }}"
    password: "{{ vcenter_password }}"
    dvswitch: 'vDS'
  delegate_to: localhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Confirm if vlan 15 is present
  community.vmware.vmware_dvs_portgroup_find:
    hostname: "{{ vcenter_hostname }}"
    username: "{{ vcenter_username }}"
    password: "{{ vcenter_password }}"
    vlanid: '15'
  delegate_to: localhost

Inputs

    
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 E(VMWARE_PORT)
      will be used instead.
    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 E(VMWARE_HOST)
      will be used instead.
    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 E(VMWARE_PASSWORD)
      will be used instead.
    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 E(VMWARE_USER)
      will be used instead.
    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 E(VMWARE_PROXY_HOST)
      will be used instead.
    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 E(VMWARE_PROXY_PORT)
      will be used instead.
    required: false
    type: int

show_uplink:
    default: false
    description:
    - Show or hide uplink portgroups.
    - Only relevant when O(vlanid) is supplied.
    type: bool

validate_certs:
    default: true
    description:
    - Allows connection when SSL certificates are not valid. Set to V(false) when certificates
      are not trusted.
    - If the value is not specified in the task, the value of environment variable E(VMWARE_VALIDATE_CERTS)
      will be used instead.
    type: bool

Outputs

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