community.vmware.vmware_dvs_portgroup – Create or remove a Distributed vSwitch portgroup.
community.vmware.vmware_dvs_portgroup – Create or remove a Distributed vSwitch portgroup.
Note
This plugin is part of the community.vmware collection (version 1.6.0).
To install it use: ansible-galaxy collection install community.vmware
.
To use it in a playbook, specify: community.vmware.vmware_dvs_portgroup
.
Synopsis
- Create or remove a Distributed vSwitch portgroup.
Requirements
The below requirements are needed on the host that executes this module.
- python >= 2.6
- PyVmomi
Parameters
Parameter | Choices/Defaults | Comments | |
---|---|---|---|
hostname string |
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 Environment variable support added in Ansible 2.6. | ||
network_policy dictionary |
Default: {"forged_transmits": false, "mac_changes": false, "promiscuous": false} |
Dictionary which configures the different security values for portgroup. | |
forged_transmits boolean |
|
Indicates whether forged transmits are allowed. | |
mac_changes boolean |
|
Indicates whether mac changes are allowed. | |
promiscuous boolean |
|
Indicates whether promiscuous mode is allowed. | |
num_ports integer / required |
The number of ports the portgroup should contain. | ||
password string |
The password of the vSphere vCenter or ESXi server. If the value is not specified in the task, the value of environment variable Environment variable support added in Ansible 2.6.
| ||
port integer |
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 Environment variable support added in Ansible 2.6. | |
port_policy dictionary |
Default: {"block_override": true, "ipfix_override": false, "live_port_move": false, "network_rp_override": false, "port_config_reset_at_disconnect": true, "security_override": false, "shaping_override": false, "traffic_filter_override": false, "uplink_teaming_override": false, "vendor_config_override": false, "vlan_override": false} |
Dictionary which configures the advanced policy settings for the portgroup. | |
block_override boolean |
|
Indicates if the block policy can be changed per port. | |
ipfix_override boolean |
|
Indicates if the ipfix policy can be changed per port. | |
live_port_move boolean |
|
Indicates if a live port can be moved in or out of the portgroup. | |
network_rp_override boolean |
|
Indicates if the network resource pool can be changed per port. | |
port_config_reset_at_disconnect boolean |
|
Indicates if the configuration of a port is reset automatically after disconnect. | |
security_override boolean |
|
Indicates if the security policy can be changed per port. | |
shaping_override boolean |
|
Indicates if the shaping policy can be changed per port. | |
traffic_filter_override boolean |
|
Indicates if the traffic filter can be changed per port. | |
uplink_teaming_override boolean |
|
Indicates if the uplink teaming policy can be changed per port. | |
vendor_config_override boolean |
|
Indicates if the vendor config can be changed per port. | |
vlan_override boolean |
|
Indicates if the vlan can be changed per port. | |
portgroup_name string / required |
The name of the portgroup that is to be created or deleted. | ||
portgroup_type string / required |
|
See VMware KB 1022312 regarding portgroup types. | |
proxy_host string |
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 This feature depends on a version of pyvmomi greater than v6.7.1.2018.12 | ||
proxy_port integer |
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 | ||
state string / required |
|
Determines if the portgroup should be present or not. | |
switch_name string / required |
The name of the distributed vSwitch the port group should be created on. | ||
teaming_policy dictionary |
Default: {"inbound_policy": false, "load_balance_policy": "loadbalance_srcid", "notify_switches": true, "rolling_order": false} |
Dictionary which configures the different teaming values for portgroup. | |
inbound_policy boolean |
|
Indicate whether or not the teaming policy is applied to inbound frames as well. | |
load_balance_policy string |
|
Network adapter teaming policy.
| |
notify_switches boolean |
|
Indicate whether or not to notify the physical switch if a link fails. | |
rolling_order boolean |
|
Indicate whether or not to use a rolling policy when restoring links. | |
username string |
The username of the vSphere vCenter or ESXi server. If the value is not specified in the task, the value of environment variable Environment variable support added in Ansible 2.6.
| ||
validate_certs boolean |
|
Allows connection when SSL certificates are not valid. Set to If the value is not specified in the task, the value of environment variable Environment variable support added in Ansible 2.6. If set to | |
vlan_id string / required |
The VLAN ID that should be configured with the portgroup, use 0 for no VLAN. If The valid If | ||
vlan_private boolean |
|
Indicates whether this is for a private VLAN or not. Mutually exclusive with | |
vlan_trunk boolean |
|
Indicates whether this is a VLAN trunk or not. Mutually exclusive with |
Notes
Note
- Tested on vSphere 5.5, 6.5
Examples
- name: Create vlan portgroup
community.vmware.vmware_dvs_portgroup:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
portgroup_name: vlan-123-portrgoup
switch_name: dvSwitch
vlan_id: 123
num_ports: 120
portgroup_type: earlyBinding
state: present
delegate_to: localhost
- name: Create vlan trunk portgroup
community.vmware.vmware_dvs_portgroup:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
portgroup_name: vlan-trunk-portrgoup
switch_name: dvSwitch
vlan_id: 1-1000, 1005, 1100-1200
vlan_trunk: True
num_ports: 120
portgroup_type: earlyBinding
state: present
delegate_to: localhost
- name: Create private vlan portgroup
vmware_dvs_portgroup:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
portgroup_name: private-vlan-portrgoup
switch_name: dvSwitch
vlan_id: 1001
vlan_private: True
num_ports: 120
portgroup_type: earlyBinding
state: present
delegate_to: localhost
- name: Create no-vlan portgroup
community.vmware.vmware_dvs_portgroup:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
portgroup_name: no-vlan-portrgoup
switch_name: dvSwitch
vlan_id: 0
num_ports: 120
portgroup_type: earlyBinding
state: present
delegate_to: localhost
- name: Create vlan portgroup with all security and port policies
community.vmware.vmware_dvs_portgroup:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
portgroup_name: vlan-123-portrgoup
switch_name: dvSwitch
vlan_id: 123
num_ports: 120
portgroup_type: earlyBinding
state: present
network_policy:
promiscuous: true
forged_transmits: true
mac_changes: true
port_policy:
block_override: true
ipfix_override: true
live_port_move: true
network_rp_override: true
port_config_reset_at_disconnect: true
security_override: true
shaping_override: true
traffic_filter_override: true
uplink_teaming_override: true
vendor_config_override: true
vlan_override: true
delegate_to: localhost
Authors
- Joseph Callen (@jcpowermac)
- Philippe Dellaert (@pdellaert) <[email protected]>
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.10/collections/community/vmware/vmware_dvs_portgroup_module.html