community.vmware.vmware_maintenancemode (4.2.0) — module

Place a host into maintenance mode

Authors: Jay Jahns (@jjahns) <jjahns@vmware.com>, Abhijeet Kasurde (@Akasurde)

Install collection

Install with ansible-galaxy collection install community.vmware:==4.2.0


Add to requirements.yml

  collections:
    - name: community.vmware
      version: 4.2.0

Description

This module can be used for placing a ESXi host into maintenance mode.

Support for VSAN compliant maintenance mode when selected.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Enter VSAN-Compliant Maintenance Mode
  community.vmware.vmware_maintenancemode:
    hostname: "{{ vcenter_hostname }}"
    username: "{{ vcenter_username }}"
    password: "{{ vcenter_password }}"
    esxi_hostname: "{{ esxi_hostname }}"
    vsan: ensureObjectAccessibility
    evacuate: true
    timeout: 3600
    state: present
  delegate_to: localhost

Inputs

    
port:
    default: 443
    description:
    - The port number of the vSphere vCenter or ESXi server.
    - If the value is not specified in the task, the value of environment variable E(VMWARE_PORT)
      will be used instead.
    type: int

vsan:
    aliases:
    - vsan_mode
    choices:
    - ensureObjectAccessibility
    - evacuateAllData
    - noAction
    description:
    - Specify which VSAN compliant mode to enter.
    required: false
    type: str

state:
    choices:
    - present
    - absent
    default: present
    description:
    - Enter or exit maintenance mode.
    required: false
    type: str

timeout:
    default: 0
    description:
    - Specify a timeout for the operation.
    required: false
    type: int

evacuate:
    default: false
    description:
    - If set to V(true), evacuate all powered off VMs.
    required: false
    type: bool

hostname:
    description:
    - The hostname or IP address of the vSphere vCenter or ESXi server.
    - If the value is not specified in the task, the value of environment variable E(VMWARE_HOST)
      will be used instead.
    type: str

password:
    aliases:
    - pass
    - pwd
    description:
    - The password of the vSphere vCenter or ESXi server.
    - If the value is not specified in the task, the value of environment variable E(VMWARE_PASSWORD)
      will be used instead.
    type: str

username:
    aliases:
    - admin
    - user
    description:
    - The username of the vSphere vCenter or ESXi server.
    - If the value is not specified in the task, the value of environment variable E(VMWARE_USER)
      will be used instead.
    type: str

proxy_host:
    description:
    - Address of a proxy that will receive all HTTPS requests and relay them.
    - The format is a hostname or a IP.
    - If the value is not specified in the task, the value of environment variable E(VMWARE_PROXY_HOST)
      will be used instead.
    required: false
    type: str

proxy_port:
    description:
    - Port of the HTTP proxy that will receive all HTTPS requests and relay them.
    - If the value is not specified in the task, the value of environment variable E(VMWARE_PROXY_PORT)
      will be used instead.
    required: false
    type: int

esxi_hostname:
    description:
    - Name of the host as defined in vCenter.
    required: true
    type: str

validate_certs:
    default: true
    description:
    - Allows connection when SSL certificates are not valid. Set to V(false) when certificates
      are not trusted.
    - If the value is not specified in the task, the value of environment variable E(VMWARE_VALIDATE_CERTS)
      will be used instead.
    type: bool

Outputs

hostname:
  description: Name of host in vCenter
  returned: always
  sample: esxi.local.domain
  type: str
hostsystem:
  description: Name of vim reference
  returned: always
  sample: '''vim.HostSystem:host-236'''
  type: str
status:
  description: Action taken
  returned: always
  sample: ENTER
  type: str