W3cubDocs

/Ansible 2.9

vmware_cluster_ha – Manage High Availability (HA) on VMware vSphere clusters

New in version 2.9.

Synopsis

  • Manages HA configuration on VMware vSphere clusters.
  • All values and VMware object names are case sensitive.

Requirements

The below requirements are needed on the host that executes this module.

  • Tested on ESXi 5.5 and 6.5.
  • PyVmomi installed.

Parameters

Parameter Choices/Defaults Comments
cluster_name
string / required
The name of the cluster to be managed.
datacenter
string / required
The name of the datacenter.

aliases: datacenter_name
enable_ha
boolean
    Choices:
  • no
  • yes
Whether to enable HA.
failover_host_admission_control
dictionary
Configure dedicated failover hosts.
slot_based_admission_control, reservation_based_admission_control and failover_host_admission_control are mutually exclusive.
failover_hosts
list / required
List of dedicated failover hosts.
ha_host_monitoring
string
    Choices:
  • enabled
  • disabled
Whether HA restarts virtual machines after a host fails.
If set to enabled, HA restarts virtual machines after a host fails.
If set to disabled, HA does not restart virtual machines after a host fails.
If enable_ha is set to no, then this value is ignored.
ha_restart_priority
string
    Choices:
  • disabled
  • high
  • low
  • medium
Priority HA gives to a virtual machine if sufficient capacity is not available to power on all failed virtual machines.
Valid only if ha_vm_monitoring is set to either vmAndAppMonitoring or vmMonitoringOnly.
If set to disabled, then HA is disabled for this virtual machine.
If set to high, then virtual machine with this priority have a higher chance of powering on after a failure, when there is insufficient capacity on hosts to meet all virtual machine needs.
If set to medium, then virtual machine with this priority have an intermediate chance of powering on after a failure, when there is insufficient capacity on hosts to meet all virtual machine needs.
If set to low, then virtual machine with this priority have a lower chance of powering on after a failure, when there is insufficient capacity on hosts to meet all virtual machine needs.
ha_vm_failure_interval
integer
Default:
30
The number of seconds after which virtual machine is declared as failed if no heartbeat has been received.
This setting is only valid if ha_vm_monitoring is set to, either vmAndAppMonitoring or vmMonitoringOnly.
Unit is seconds.
ha_vm_max_failure_window
integer
Default:
-1
The number of seconds for the window during which up to ha_vm_max_failures resets can occur before automated responses stop.
Valid only when ha_vm_monitoring is set to either vmAndAppMonitoring or vmMonitoringOnly.
Unit is seconds.
Default specifies no failure window.
ha_vm_max_failures
integer
Default:
3
Maximum number of failures and automated resets allowed during the time that ha_vm_max_failure_window specifies.
Valid only when ha_vm_monitoring is set to either vmAndAppMonitoring or vmMonitoringOnly.
ha_vm_min_up_time
integer
Default:
120
The number of seconds for the virtual machine's heartbeats to stabilize after the virtual machine has been powered on.
Valid only when ha_vm_monitoring is set to either vmAndAppMonitoring or vmMonitoringOnly.
Unit is seconds.
ha_vm_monitoring
string
    Choices:
  • vmAndAppMonitoring
  • vmMonitoringOnly
  • vmMonitoringDisabled
State of virtual machine health monitoring service.
If set to vmAndAppMonitoring, HA response to both virtual machine and application heartbeat failure.
If set to vmMonitoringDisabled, virtual machine health monitoring is disabled.
If set to vmMonitoringOnly, HA response to virtual machine heartbeat failure.
If enable_ha is set to no, then this value is ignored.
host_isolation_response
string
    Choices:
  • none
  • powerOff
  • shutdown
Indicates whether or VMs should be powered off if a host determines that it is isolated from the rest of the compute resource.
If set to none, do not power off VMs in the event of a host network isolation.
If set to powerOff, power off VMs in the event of a host network isolation.
If set to shutdown, shut down VMs guest operating system in the event of a host network isolation.
hostname
string
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 VMWARE_HOST will be used instead.
Environment variable support added in Ansible 2.6.
password
string
The password of the vSphere vCenter or ESXi server.
If the value is not specified in the task, the value of environment variable VMWARE_PASSWORD will be used instead.
Environment variable support added in Ansible 2.6.

aliases: pass, pwd
port
integer
added in 2.5
Default:
443
The port number of the vSphere vCenter or ESXi server.
If the value is not specified in the task, the value of environment variable VMWARE_PORT will be used instead.
Environment variable support added in Ansible 2.6.
proxy_host
string
added in 2.9
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 VMWARE_PROXY_HOST will be used instead.
This feature depends on a version of pyvmomi greater than v6.7.1.2018.12
proxy_port
integer
added in 2.9
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 VMWARE_PROXY_PORT will be used instead.
reservation_based_admission_control
dictionary
Configure reservation based admission control policy.
slot_based_admission_control, reservation_based_admission_control and failover_host_admission_control are mutually exclusive.
auto_compute_percentages
boolean
    Choices:
  • no
  • yes
By default, failover_level is used to calculate cpu_failover_resources_percent and memory_failover_resources_percent. If a user wants to override the percentage values, he has to set this field to false.
cpu_failover_resources_percent
integer
Default:
50
Percentage of CPU resources in the cluster to reserve for failover. Ignored if auto_compute_percentages is not set to false.
failover_level
integer / required
Number of host failures that should be tolerated.
memory_failover_resources_percent
integer
Default:
50
Percentage of memory resources in the cluster to reserve for failover. Ignored if auto_compute_percentages is not set to false.
slot_based_admission_control
dictionary
Configure slot based admission control policy.
slot_based_admission_control, reservation_based_admission_control and failover_host_admission_control are mutually exclusive.
failover_level
integer / required
Number of host failures that should be tolerated.
username
string
The username of the vSphere vCenter or ESXi server.
If the value is not specified in the task, the value of environment variable VMWARE_USER will be used instead.
Environment variable support added in Ansible 2.6.

aliases: admin, user
validate_certs
boolean
    Choices:
  • no
  • yes
Allows connection when SSL certificates are not valid. Set to false when certificates are not trusted.
If the value is not specified in the task, the value of environment variable VMWARE_VALIDATE_CERTS will be used instead.
Environment variable support added in Ansible 2.6.
If set to yes, please make sure Python >= 2.7.9 is installed on the given machine.

Examples

- name: Enable HA without admission control
  vmware_cluster_ha:
    hostname: '{{ vcenter_hostname }}'
    username: '{{ vcenter_username }}'
    password: '{{ vcenter_password }}'
    datacenter_name: datacenter
    cluster_name: cluster
    enable_ha: yes
  delegate_to: localhost

- name: Enable HA and VM monitoring without admission control
  vmware_cluster_ha:
    hostname: "{{ vcenter_hostname }}"
    username: "{{ vcenter_username }}"
    password: "{{ vcenter_password }}"
    validate_certs: no
    datacenter_name: DC0
    cluster_name: "{{ cluster_name }}"
    enable_ha: True
    ha_vm_monitoring: vmMonitoringOnly
  delegate_to: localhost

- name: Enable HA with admission control reserving 50% of resources for HA
  vmware_cluster_ha:
    hostname: '{{ vcenter_hostname }}'
    username: '{{ vcenter_username }}'
    password: '{{ vcenter_password }}'
    datacenter_name: datacenter
    cluster_name: cluster
    enable_ha: yes
    reservation_based_admission_control:
      auto_compute_percentages: False
      failover_level: 1
      cpu_failover_resources_percent: 50
      memory_failover_resources_percent: 50
  delegate_to: localhost

Status

Authors

  • Joseph Callen (@jcpowermac)
  • Abhijeet Kasurde (@Akasurde)

Hint

If you notice any issues in this documentation, you can edit this document to improve it.

© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.9/modules/vmware_cluster_ha_module.html