The vmware_dvs_host module

Using this module, you can add or remove a host from the distributed virtual switch:

- name: Add host to dvs  vmware_dvs_host:    hostname: "{{ vsphere_host }}"    username: "{{ vsphere_username }}"    password: "{{ vsphere_password }}"    validate_certs: "no"    esxi_hostname: "{{ exsi_host }}"    switch_name: "my_dvSwitch"    vmnics:      - "vmnic1"      - "vmnic2"    state: "present"  delegate_to: "localhost"

Get Learn Ansible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.