vmware.vmware.cluster_ha module – Manage High Availability services (HA) on VMware vSphere clusters
Note
This module is part of the vmware.vmware collection (version 1.11.0).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install vmware.vmware
.
To use it in a playbook, specify: vmware.vmware.cluster_ha
.
Synopsis
Manages HA on VMware vSphere clusters.
Parameters
Parameter |
Comments |
---|---|
Percentage of CPU resources in the cluster to reserve for failover. Only used if By default, the |
|
List of ESXi hosts to use as dedicated failover hosts. The list should be the names of ESXi hosts as seen in vCenter. Required if (and only used if) |
|
The number of host failures that should be tolerated by the cluster. The maximum is one less than the total number of hosts. Only used if Default: |
|
Percentage of memory resources in the cluster to reserve for failover. Only used if By default, the |
|
Configures a the policy type used for HA admission control. Admission control is a policy used by vSphere HA to ensure failover capacity within a cluster. Raising the number of potential host failures will increase the availability constraints and capacity reserved. Choices:
|
|
A dictionary of advanced HA settings. Default: |
|
The name of the cluster to be managed. |
|
The name of the datacenter. |
|
Whether to enable HA. Choices:
|
|
Configures how VM workflows should be managed if an ESXi host is in a failure state. |
|
Set the default priority HA gives to a virtual machine if sufficient capacity is not available to power on all failed virtual machines. Used only when Choices:
|
|
If true, HA will restart virtual machines after a host fails and comes back online. Choices:
|
|
Specify how VMs should be handled if an ESXi host determines it can no longer reach the rest of the cluster. If set to If set to If set to Choices:
|
|
The hostname or IP address of the vSphere vCenter server. If the value is not specified in the task, the value of environment variable |
|
The password of the vSphere vCenter server. If the value is not specified in the task, the value of environment variable |
|
The port number of the vSphere vCenter server. If the value is not specified in the task, the value of environment variable Default: |
|
The 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 |
|
The 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 |
|
Configures what steps are taken when storage All Paths Down (APD) events occur. |
|
Set the response recovery delay time in seconds if storage is in an APD failure state. This is only used if Default: |
|
Set the response in the event of All Paths Down (APD) for storage. APD differs from PDL, in that APD is assumed to be a transient outage and PDL is permanent.
Choices:
|
|
If true, VMs will be restarted when possible if storage is in an APD failure state. This is only used if Choices:
|
|
Set the response in the event of permanent Device Loss (PDL) for storage. APD differs from PDL, in that APD is assumed to be a transient outage and PDL is permanent.
Choices:
|
|
The username of the vSphere vCenter server. If the value is not specified in the task, the value of environment variable |
|
Allows connection when SSL certificates are not valid. Set to If the value is not specified in the task, the value of environment variable Choices:
|
|
Configures how VMs are monitored to determine health status, and what actions should be taken if they are unhealthy. |
|
The number of seconds to wait after a VM heartbeat fails before declaring the VM as unhealthy. Valid only when Default: |
|
The maximum number of automated resets allowed in response to a VM becoming unhealthy Valid only when Default: |
|
The number of seconds during in which Valid only when The default value of -1 specifies no window. Default: |
|
The number of seconds to wait for the VM’s heartbeat to stabilize after it was powered reset. Valid only when Default: |
|
Sets the state of the virtual machine health monitoring service. If set to If set to If set to Choices:
|
Notes
Note
All modules require API write access and hence are not supported on a free ESXi license.
All variables and VMware object names are case sensitive.
Modules may rely on the ‘requests’ python library, which does not use the system certificate store by default. You can specify the certificate store by setting the REQUESTS_CA_BUNDLE environment variable. Example: ‘export REQUESTS_CA_BUNDLE=/path/to/your/ca_bundle.pem’
Examples
- name: Enable HA With vCenter Defaults
vmware.vmware.cluster_ha:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: DC01
cluster: my-cluster
- name: Disable HA
vmware.vmware.cluster_ha:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: DC01
cluster: my-cluster
enable: false
- name: Set HA Settings In Cluster
vmware.vmware.cluster_ha:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: DC01
cluster: my-cluster
host_failure_response:
restart_vms: true
default_vm_restart_priority: low
host_isolation_response: powerOff
admission_control_policy: dedicated_host
admission_control_dedicated_hosts:
- DC0_C0_H0
- DC0_C0_H1
vm_monitoring:
mode: vmAndAppMonitoring
storage_apd_response:
mode: restartConservative
delay: 100
restart_vms: true
storage_pdl_response_mode: restart
# If you do not set a parameter and it has no default, the module will ignore
# the corresponding vCenter setting when checking for config diffs and applying new configs
- name: Only Manage Host Failure Settings
vmware.vmware.cluster_ha:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: DC01
cluster: my-cluster
host_failure_response:
restart_vms: true
default_vm_restart_priority: low
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
Information about the HA config update task, if something changed If nothing changed, an empty dictionary is returned Returned: On success Sample: |