vmware_dvswitch - Create or remove a distributed vSwitch

New in version 2.0.

Synopsis

  • Create or remove a distributed vSwitch

Requirements

The below requirements are needed on the host that executes this module.

  • python >= 2.6
  • PyVmomi

Parameters

Parameter Choices/Defaults Comments
datacenter_name
required
The name of the datacenter that will contain the dvSwitch
discovery_operation
    Choices:
  • both
  • none
  • advertise
  • listen
Select the discovery operation
discovery_proto
required
    Choices:
  • cdp
  • lldp
Link discovery protocol between Cisco and Link Layer discovery
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.
mtu
required
The switch maximum transmission unit
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.
state
    Choices:
  • present
  • absent
Create or remove dvSwitch
switch_name
required
The name of the switch to create or remove
switch_version
(added in 2.5)
The version of the switch to create. Can be 6.5.0, 6.0.0, 5.5.0, 5.1.0, 5.0.0 with a vcenter running vSphere 6.5
Needed if you have a vcenter version > ESXi version to join DVS. If not specified version=version of vcenter
uplink_quantity
required
Quantity of uplink per ESXi host added to the switch
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
    Choices:
  • no
  • yes
Default:
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.

Notes

Note

  • Tested on vSphere 6.5

Examples

- name: Create dvswitch
  local_action:
    module: vmware_dvswitch
    hostname: vcenter_ip_or_hostname
    username: vcenter_username
    password: vcenter_password
    datacenter_name: datacenter
    switch_name: dvSwitch
    switch_version: 6.0.0
    mtu: 9000
    uplink_quantity: 2
    discovery_proto: lldp
    discovery_operation: both
    state: present

Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

Author

  • Joseph Callen (@jcpowermac)

Hint

If you notice any issues in this documentation you can edit this document to improve it.

© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.5/modules/vmware_dvswitch_module.html