vmware_dvs_host - Add or remove a host from distributed virtual switch

New in version 2.0.

Synopsis

  • Add or remove a host from distributed virtual switch

Requirements (on host that executes module)

  • python >= 2.7
  • PyVmomi

Options

parameter required default choices comments
esxi_hostname
yes
The ESXi hostname
hostname
yes
The hostname or IP address of the vSphere vCenter.
password
yes
The password of the vSphere vCenter.
aliases: pass, pwd
state
yes
  • present
  • absent
If the host should be present or absent attached to the vSwitch
switch_name
yes
The name of the Distributed vSwitch
username
yes
The username of the vSphere vCenter.
aliases: user, admin
validate_certs
no True
  • True
  • False
Allows connection when SSL certificates are not valid. Set to false when certificates are not trusted.
vmnics
yes
The ESXi hosts vmnics to use with the Distributed vSwitch

Examples

# Example vmware_dvs_host command from Ansible Playbooks
- name: Add Host to dVS
  local_action:
    module: vmware_dvs_host
    hostname: vcenter_ip_or_hostname
    username: vcenter_username
    password: vcenter_password
    esxi_hostname: esxi_hostname_as_listed_in_vcenter
    switch_name: dvSwitch
    vmnics:
        - vmnic0
        - vmnic1
    state: present

Notes

Note

  • Tested on vSphere 5.5

Status

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

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Testing Ansible and Developing Modules.

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