community.vmware.vmware_dvswitch – Create or remove a Distributed Switch
community.vmware.vmware_dvswitch – Create or remove a Distributed Switch
Note
This plugin is part of the community.vmware collection (version 1.7.0).
To install it use: ansible-galaxy collection install community.vmware
.
To use it in a playbook, specify: community.vmware.vmware_dvswitch
.
Synopsis
- This module can be used to create, remove a Distributed Switch.
Requirements
The below requirements are needed on the host that executes this module.
- python >= 2.6
- PyVmomi
Parameters
Parameter | Choices/Defaults | Comments | |
---|---|---|---|
contact dictionary |
Dictionary which configures administrator contact name and description for the Distributed Switch. | ||
description string |
Description or other details. | ||
name string |
Administrator name. | ||
datacenter_name string |
The name of the datacenter that will contain the Distributed Switch. This parameter is optional, if Mutually exclusive with
| ||
description string |
Description of the Distributed Switch. | ||
discovery_operation string |
|
Select the discovery operation. Required parameter for Required only if | |
discovery_proto string |
|
Link discovery protocol between Cisco and Link Layer discovery. Required parameter for Required only if
| |
folder string |
Destination folder, absolute path to place dvswitch in. The folder should include the datacenter. This parameter is case sensitive. This parameter is optional, if Examples: folder: /datacenter1/network folder: datacenter1/network folder: /datacenter1/network/folder1 folder: datacenter1/network/folder1 folder: /folder1/datacenter1/network folder: folder1/datacenter1/network folder: /folder1/datacenter1/network/folder2 | ||
health_check dictionary |
Default: {"teaming_failover": false, "teaming_failover_interval": 0, "vlan_mtu": false, "vlan_mtu_interval": 0} |
Dictionary which configures Health Check for the Distributed Switch. | |
teaming_failover boolean |
|
Teaming and failover health check. | |
teaming_failover_interval integer |
Default: 0 |
Teaming and failover health check interval (minutes). The default value is 1 in the vSphere Client if the Teaming and failover health check is enabled. | |
vlan_mtu boolean |
|
VLAN and MTU health check. | |
vlan_mtu_interval integer |
Default: 0 |
VLAN and MTU health check interval (minutes). The default value is 1 in the vSphere Client if the VLAN and MTU health check is enabled. | |
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. | ||
mtu integer |
Default: 1500 |
The switch maximum transmission unit. Required parameter for Required only if Accepts value between 1280 to 9000 (both inclusive). | |
multicast_filtering_mode string |
|
The multicast filtering mode.
| |
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. | |
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 |
|
If set to If set to | |
switch_name string / required |
The name of the distribute vSwitch to create or remove.
| ||
switch_version string |
|
The version of the Distributed Switch to create. Can be 6.0.0, 5.5.0, 5.1.0, 5.0.0 with a vCenter running vSphere 6.0 and 6.5. Can be 6.6.0, 6.5.0, 6.0.0 with a vCenter running vSphere 6.7. Can be 7.0.0, 6.6.0, 6.5.0 with a vCenter running vSphere 7.0. The version must match the version of the ESXi hosts you want to connect. The version of the vCenter server is used if not specified. Required only if
| |
uplink_prefix string |
Default: "Uplink " |
The prefix used for the naming of the uplinks. Only valid if the Distributed Switch will be created. Not used if the Distributed Switch is already present. Uplinks are created as Uplink 1, Uplink 2, etc. pp. by default. | |
uplink_quantity integer |
Quantity of uplink per ESXi host added to the Distributed Switch. The uplink quantity can be increased or decreased, but a decrease will only be successfull if the uplink isn't used by a portgroup. Required parameter for Required only if | ||
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 |
Notes
Note
- Tested on vSphere 6.5, 6.7 and 7.0
Examples
- name: Create dvSwitch
community.vmware.vmware_dvswitch:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter: '{{ datacenter }}'
switch: dvSwitch
version: 6.0.0
mtu: 9000
uplink_quantity: 2
discovery_protocol: lldp
discovery_operation: both
state: present
delegate_to: localhost
- name: Create dvSwitch with all options
community.vmware.vmware_dvswitch:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter: '{{ datacenter }}'
switch: dvSwitch
version: 6.5.0
mtu: 9000
uplink_quantity: 2
uplink_prefix: 'Uplink_'
discovery_protocol: cdp
discovery_operation: both
multicast_filtering_mode: snooping
health_check:
vlan_mtu: true
vlan_mtu_interval: 1
teaming_failover: true
teaming_failover_interval: 1
state: present
delegate_to: localhost
- name: Delete dvSwitch
community.vmware.vmware_dvswitch:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter: '{{ datacenter }}'
switch: dvSwitch
state: absent
delegate_to: localhost
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description |
---|---|---|
result string |
always |
information about performed operation
Sample: {'changed': False, 'contact': None, 'contact_details': None, 'description': None, 'discovery_operation': 'both', 'discovery_protocol': 'cdp', 'dvswitch': 'test', 'health_check_teaming': False, 'health_check_teaming_interval': 0, 'health_check_vlan': False, 'health_check_vlan_interval': 0, 'mtu': 9000, 'multicast_filtering_mode': 'basic', 'result': 'DVS already configured properly', 'uplink_quantity': 2, 'uplinks': ['Uplink_1', 'Uplink_2'], 'version': '6.6.0'} |
Authors
- Joseph Callen (@jcpowermac)
- Abhijeet Kasurde (@Akasurde)
- Christian Kotte (@ckotte)
© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.11/collections/community/vmware/vmware_dvswitch_module.html