The vmware_maintenancemode module

Using this module, you can place a host into maintenance mode. The following example shows you how to put a host into maintenance while maintaining object availability on the VSAN:

- name: Put host into maintenance mode  vmware_maintenancemode:    hostname: "{{ vsphere_host }}"    username: "{{ vsphere_username }}"    password: "{{ vsphere_password }}"    validate_certs: "no"    esxi_hostname: "{{ exsi_host }}"    vsan: "ensureObjectAccessibility"    evacuate: "yes"    timeout: "3600"    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.