Documentation

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.6
  • 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
            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

              This is an Extras Module

              For more information on what this means please read Extras Modules

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