maxhoesel.proxmox.proxmox_ha module – Manage HA in a Proxmox cluster

Note

This module is part of the maxhoesel.proxmox collection (version 5.1.1).

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 maxhoesel.proxmox. You need further requirements to be able to use this module, see Requirements for details.

To use it in a playbook, specify: maxhoesel.proxmox.proxmox_ha.

New in maxhoesel.proxmox 2.8.0

Synopsis

  • Manage the HA status/membership of individual guests in a Proxmox VE cluster

Aliases: ha

Requirements

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

  • proxmoxer >=1.2

  • requests

Parameters

Parameter

Comments

api_host

string / required

Specify the target host of the Proxmox VE cluster.

api_password

string

Specify the password to authenticate with.

You can also use the PROXMOX_PASSWORD environment variable.

api_user

string / required

Specify the user to authenticate with.

comment

string

Add a comment to the HA resource. This comment is not parsed and is only used for documentation.

digest

string

Specify if to prevent changes if current configuration file has different SHA1 digest.

This can be used to prevent concurrent modifications.

group

string

Specify the HA group that the guest should be a member of

max_relocate

integer

Specify the maximum number of relocates to attempt before a service is considered “failed”

max_restart

integer

Specify the maximum number of restarts to attempt before a service is considered “failed”

name

string

Specify the name of the guest whose HA resource will be modified.

Automatically fetches the correct VMID.

You can also specify the VMID directly using vmid.

state

string

present: Alias for started

absent: Will remove the HA resource if present

started/stopped/disabled/ignored: Will configure the resource and set the PVE HA state to the requested value

For more information on the individual states, please refer to the PVE documentation

Choices:

  • "present"

  • "absent"

  • "started" ← (default)

  • "stopped"

  • "disabled"

  • "ignored"

validate_certs

boolean

Validate SSL certificate of the PVE host upon connecting

Choices:

  • false ← (default)

  • true

vmid

integer

Specify the VMID of the guest whose HA resource will be modified. Will be fetched automatically if name is set.

Examples

# Create a basic HA resource for a guest (and ensure that the guest is started)
- proxmox_ha:
    api_user: root@pam
    api_password: secret
    api_host: helldorado
    name: myvirtualmachine

# Create a HA resource for a VMID and set the state to "stopped"
- proxomx_ha:
    api_user: root@pam
    api_password: secret
    api_host: helldorado
    vmid: 123
    state: stopped

# Remove a HA resource by guest name
- proxomx_ha:
    api_user: root@pam
    api_password: secret
    api_host: helldorado
    name: myvirtualmachine
    state: absent

Authors

  • Max Hösel (@maxhoesel)