This module lets you create a VMware port group on the hosts in a given cluster:
- name: Create a portgroup with vlan
vmware_portgroup:
hostname: "{{ vsphere_host }}"
username: "{{ vsphere_username }}"
password: "{{ vsphere_password }}"
validate_certs: "no"
cluster_name: "my_cluster"
switch_name: "my_switch"
portgroup_name: "my_portgroup_vlan123"
vlan_id: "123"
delegate_to: "localhost"