The vmware_vswitch module

Using this module, you can add or remove a VMware Standard Switch (vSwitch) to an ESXi host:

- name: Add a vSwitch  vmware_vswitch:    hostname: "{{ vsphere_host }}"    username: "{{ vsphere_username }}"    password: "{{ vsphere_password }}"    validate_certs: "no"    switch: "vswitch_name"    nics:      - "vmnic1"      - "vmnic2"    mtu: "9000"  delegate_to: "localhost"

In this example, we have added a vSwitch that's attached to multiple vmnics.

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.