New in version 2.0.
The below requirements are needed on the host that executes this module.
Parameter | Choices/Defaults | Comments |
---|---|---|
cluster_name
(added in 2.5) |
Name of cluster name for host membership.
Portgroup will be created on all hosts of the given cluster.
This option is required if
hosts is not specified. |
|
hostname |
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
VMWARE_HOST will be used instead.Environment variable supported added in version 2.6.
|
|
hosts
(added in 2.5) |
List of name of host or hosts on which portgroup needs to be added.
This option is required if
cluster_name is not specified.aliases: esxi_hostname |
|
network_policy
(added in 2.2) |
Default: {u'mac_changes': False, u'promiscuous_mode': False, u'forged_transmits': False}
|
Network policy specifies layer 2 security settings for a portgroup such as promiscuous mode, where guest adapter listens to all the packets, MAC address changes and forged transmits.
Dict which configures the different security values for portgroup.
Valid attributes are:
-
promiscuous_mode (bool): indicates whether promiscuous mode is allowed. (default: false)-
forged_transmits (bool): indicates whether forged transmits are allowed. (default: false)-
mac_changes (bool): indicates whether mac changes are allowed. (default: false) |
password |
The password of the vSphere vCenter or ESXi server.
If the value is not specified in the task, the value of environment variable
VMWARE_PASSWORD will be used instead.Environment variable supported added in version 2.6.
aliases: pass, pwd |
|
port
(added in 2.5) |
Default: 443
|
The port number of the vSphere vCenter or ESXi server.
If the value is not specified in the task, the value of environment variable
VMWARE_PORT will be used instead.Environment variable supported added in version 2.6.
|
portgroup_name
required |
Portgroup name to add.
|
|
state
(added in 2.5) |
|
Determines if the portgroup should be present or not.
|
switch_name
required |
vSwitch to modify.
|
|
teaming_policy
(added in 2.6) |
Default: {u'notify_switches': True, u'load_balance_policy': u'loadbalance_srcid', u'inbound_policy': False, u'rolling_order': False}
|
Dictionary which configures the different teaming values for portgroup.
Valid attributes are:
-
load_balance_policy (string): Network adapter teaming policy. (default: loadbalance_srcid)- choices: [ loadbalance_ip, loadbalance_srcmac, loadbalance_srcid, failover_explicit ]
-
inbound_policy (bool): Indicate whether or not the teaming policy is applied to inbound frames as well. (default: False)-
notify_switches (bool): Indicate whether or not to notify the physical switch if a link fails. (default: True)-
rolling_order (bool): Indicate whether or not to use a rolling policy when restoring links. (default: False) |
username |
The username of the vSphere vCenter or ESXi server.
If the value is not specified in the task, the value of environment variable
VMWARE_USER will be used instead.Environment variable supported added in version 2.6.
aliases: user, admin |
|
validate_certs |
True
|
Allows connection when SSL certificates are not valid. Set to
false when certificates are not trusted.If the value is not specified in the task, the value of environment variable
VMWARE_VALIDATE_CERTS will be used instead.Environment variable supported added in version 2.6.
|
vlan_id
required |
VLAN ID to assign to portgroup.
|
- name: Add Management Network VM Portgroup
vmware_portgroup:
hostname: esxi_hostname
username: esxi_username
password: esxi_password
switch_name: vswitch_name
portgroup_name: portgroup_name
vlan_id: vlan_id
- name: Add Portgroup with Promiscuous Mode Enabled
vmware_portgroup:
hostname: esxi_hostname
username: esxi_username
password: esxi_password
switch_name: vswitch_name
portgroup_name: portgroup_name
network_policy:
promiscuous_mode: True
- name: Add Management Network VM Portgroup to specific hosts
vmware_portgroup:
hostname: vCenter_hostname
username: esxi_username
password: esxi_password
hosts: [esxi_hostname_one]
switch_name: vswitch_name
portgroup_name: portgroup_name
vlan_id: vlan_id
- name: Add Management Network VM Portgroup to all hosts in a cluster
vmware_portgroup:
hostname: vCenter_hostname
username: esxi_username
password: esxi_password
cluster_name: rh_engineering
switch_name: vswitch_name
portgroup_name: portgroup_name
vlan_id: vlan_id
- name: Remove Management Network VM Portgroup to all hosts in a cluster
vmware_portgroup:
hostname: vCenter_hostname
username: esxi_username
password: esxi_password
cluster_name: rh_engineering
switch_name: vswitch_name
portgroup_name: portgroup_name
vlan_id: vlan_id
state: absent
- name: Add Portgroup with teaming policy
vmware_portgroup:
hostname: esxi_hostname
username: esxi_username
password: esxi_password
switch_name: vswitch_name
portgroup_name: portgroup_name
teaming_policy:
load_balance_policy: 'failover_explicit'
inbound_policy: True
register: teaming_result
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description |
---|---|---|
result
dict
|
always |
metadata about the portgroup
Sample:
{'esxi01.example.com': {'portgroup_name': 'pg0010', 'switch_name': 'vswitch_0001', 'vlan_id': 1}}
|
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
Hint
If you notice any issues in this documentation you can edit this document to improve it.