ansible.builtin.vmware_cluster_ha (v2.9.24) — module

Manage High Availability (HA) on VMware vSphere clusters

| "added in version" 2.9 of ansible.builtin"

Authors: Joseph Callen (@jcpowermac), Abhijeet Kasurde (@Akasurde)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.24

Description

Manages HA configuration on VMware vSphere clusters.

All values and VMware object names are case sensitive.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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

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 C(VMWARE_PORT)
      will be used instead.
    - Environment variable support added in Ansible 2.6.
    type: int

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 C(VMWARE_HOST)
      will be used instead.
    - Environment variable support added in Ansible 2.6.
    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 C(VMWARE_PASSWORD)
      will be used instead.
    - Environment variable support added in Ansible 2.6.
    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 C(VMWARE_USER)
      will be used instead.
    - Environment variable support added in Ansible 2.6.
    type: str

enable_ha:
    default: 'no'
    description:
    - Whether to enable HA.
    type: bool

datacenter:
    aliases:
    - datacenter_name
    description:
    - The name of the datacenter.
    required: true
    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 C(VMWARE_PROXY_HOST)
      will be used instead.
    - This feature depends on a version of pyvmomi greater than v6.7.1.2018.12
    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 C(VMWARE_PROXY_PORT)
      will be used instead.
    required: false
    type: int

cluster_name:
    description:
    - The name of the cluster to be managed.
    required: true
    type: str

validate_certs:
    default: true
    description:
    - Allows connection when SSL certificates are not valid. Set to C(false) when certificates
      are not trusted.
    - If the value is not specified in the task, the value of environment variable C(VMWARE_VALIDATE_CERTS)
      will be used instead.
    - Environment variable support added in Ansible 2.6.
    - If set to C(true), please make sure Python >= 2.7.9 is installed on the given machine.
    type: bool

ha_vm_monitoring:
    choices:
    - vmAndAppMonitoring
    - vmMonitoringOnly
    - vmMonitoringDisabled
    default: vmMonitoringDisabled
    description:
    - State of virtual machine health monitoring service.
    - If set to C(vmAndAppMonitoring), HA response to both virtual machine and application
      heartbeat failure.
    - If set to C(vmMonitoringDisabled), virtual machine health monitoring is disabled.
    - If set to C(vmMonitoringOnly), HA response to virtual machine heartbeat failure.
    - If C(enable_ha) is set to C(no), then this value is ignored.
    type: str

ha_vm_min_up_time:
    default: 120
    description:
    - The number of seconds for the virtual machine's heartbeats to stabilize after the
      virtual machine has been powered on.
    - Valid only when I(ha_vm_monitoring) is set to either C(vmAndAppMonitoring) or C(vmMonitoringOnly).
    - Unit is seconds.
    type: int

ha_host_monitoring:
    choices:
    - enabled
    - disabled
    default: enabled
    description:
    - Whether HA restarts virtual machines after a host fails.
    - If set to C(enabled), HA restarts virtual machines after a host fails.
    - If set to C(disabled), HA does not restart virtual machines after a host fails.
    - If C(enable_ha) is set to C(no), then this value is ignored.
    type: str

ha_vm_max_failures:
    default: 3
    description:
    - Maximum number of failures and automated resets allowed during the time that C(ha_vm_max_failure_window)
      specifies.
    - Valid only when I(ha_vm_monitoring) is set to either C(vmAndAppMonitoring) or C(vmMonitoringOnly).
    type: int

ha_restart_priority:
    choices:
    - disabled
    - high
    - low
    - medium
    default: medium
    description:
    - Priority HA gives to a virtual machine if sufficient capacity is not available to
      power on all failed virtual machines.
    - Valid only if I(ha_vm_monitoring) is set to either C(vmAndAppMonitoring) or C(vmMonitoringOnly).
    - If set to C(disabled), then HA is disabled for this virtual machine.
    - If set to C(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 C(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 C(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.
    type: str

ha_vm_failure_interval:
    default: 30
    description:
    - The number of seconds after which virtual machine is declared as failed if no heartbeat
      has been received.
    - This setting is only valid if C(ha_vm_monitoring) is set to, either C(vmAndAppMonitoring)
      or C(vmMonitoringOnly).
    - Unit is seconds.
    type: int

host_isolation_response:
    choices:
    - none
    - powerOff
    - shutdown
    default: none
    description:
    - 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 C(none), do not power off VMs in the event of a host network isolation.
    - If set to C(powerOff), power off VMs in the event of a host network isolation.
    - If set to C(shutdown), shut down VMs guest operating system in the event of a host
      network isolation.
    type: str

ha_vm_max_failure_window:
    default: -1
    description:
    - The number of seconds for the window during which up to C(ha_vm_max_failures) resets
      can occur before automated responses stop.
    - Valid only when I(ha_vm_monitoring) is set to either C(vmAndAppMonitoring) or C(vmMonitoringOnly).
    - Unit is seconds.
    - Default specifies no failure window.
    type: int

slot_based_admission_control:
    description:
    - Configure slot based admission control policy.
    - C(slot_based_admission_control), C(reservation_based_admission_control) and C(failover_host_admission_control)
      are mutually exclusive.
    suboptions:
      failover_level:
        description:
        - Number of host failures that should be tolerated.
        required: true
        type: int
    type: dict

failover_host_admission_control:
    description:
    - Configure dedicated failover hosts.
    - C(slot_based_admission_control), C(reservation_based_admission_control) and C(failover_host_admission_control)
      are mutually exclusive.
    suboptions:
      failover_hosts:
        description:
        - List of dedicated failover hosts.
        required: true
        type: list
    type: dict

reservation_based_admission_control:
    description:
    - Configure reservation based admission control policy.
    - C(slot_based_admission_control), C(reservation_based_admission_control) and C(failover_host_admission_control)
      are mutually exclusive.
    suboptions:
      auto_compute_percentages:
        default: true
        description:
        - By default, C(failover_level) is used to calculate C(cpu_failover_resources_percent)
          and C(memory_failover_resources_percent). If a user wants to override the percentage
          values, he has to set this field to false.
        type: bool
      cpu_failover_resources_percent:
        default: 50
        description:
        - Percentage of CPU resources in the cluster to reserve for failover. Ignored
          if C(auto_compute_percentages) is not set to false.
        type: int
      failover_level:
        description:
        - Number of host failures that should be tolerated.
        required: true
        type: int
      memory_failover_resources_percent:
        default: 50
        description:
        - Percentage of memory resources in the cluster to reserve for failover. Ignored
          if C(auto_compute_percentages) is not set to false.
        type: int
    type: dict