community.proxmox.proxmox_cluster_ha_rules_info module – Retrieve Proxmox VE HA rules

Note

This module is part of the community.proxmox collection (version 2.0.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 community.proxmox. You need further requirements to be able to use this module, see Requirements for details.

To use it in a playbook, specify: community.proxmox.proxmox_cluster_ha_rules_info.

New in community.proxmox 2.0.0

Synopsis

  • Retreive Proxmox VE High Availability managed resources rules

Requirements

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

  • proxmoxer >= 2.3

  • requests

Parameters

Parameter

Comments

api_host

string / required

Specify the target host of the Proxmox VE cluster.

Uses the PROXMOX_HOST environment variable if not specified.

api_otp

string

Specify the OTP.

Uses the PROXMOX_OTP environment variable if not specified.

api_password

string

Specify the password to authenticate with.

Uses the PROXMOX_PASSWORD environment variable if not specified.

api_port

integer

Specify the target port of the Proxmox VE cluster.

Uses the PROXMOX_PORT environment variable if not specified.

api_timeout

integer

Time limit for requests towards the Proxmox VE API.

Default: 5

api_token_id

string

Specify the token ID.

Uses the PROXMOX_TOKEN_ID environment variable if not specified.

api_token_secret

string

Specify the token secret.

Uses the PROXMOX_TOKEN_SECRET environment variable if not specified.

api_user

string / required

Specify the user to authenticate with.

Uses the PROXMOX_USER environment variable if not specified.

ca_path

path

Path to a local certificate, which will be used to verify TLS connections.

Ignored if validate_certs=false.

resource

string

Target rules affecting the specified resource.

rule

aliases: name

string

Target by rule name.

type

string

Target rules by type.

Choices:

  • "node-affinity"

  • "resource-affinity"

validate_certs

boolean

Validate the TLS certificates used for the connection to the Proxmox VE API.

May be set through the environment variable PROXMOX_VALIDATE_CERTS.

Choices:

  • false

  • true ← (default)

Attributes

Attribute

Support

Description

action_group

Action group: community.proxmox.proxmox

Use group/community.proxmox.proxmox in module_defaults to set defaults for this module.

check_mode

Support: full

This action does not modify state.

Can run in check_mode and return changed status prediction without modifying target.

diff_mode

Support: N/A

This action does not modify state.

Will return details on what has changed (or possibly needs changing in check_mode), when in diff mode.

See Also

See also

community.proxmox.proxmox_cluster_ha_rules

Management of HA rules

Proxmox HA rules configuration

Complete reference of Proxmox VE HA rules

Authentication

Complete guide for the Proxmox API authentication

Examples

- name: Get prefer-pve-001 HA rule
  community.proxmox.proxmox_cluster_ha_rules_info:
    rule: prefer-pve-001

- name: List HA rules
  community.proxmox.proxmox_cluster_ha_rules_info:

- name: List HA node-affinity rules
  community.proxmox.proxmox_cluster_ha_rules_info:
    type: node-affinity

- name: List HA resource-affinity rules
  community.proxmox.proxmox_cluster_ha_rules_info:
    type: resource-affinity

- name: List HA rules affected by a resource
  community.proxmox.proxmox_cluster_ha_rules_info:
    resource: vm:100

- name: List HA node-affinity rules affected by a resource
  community.proxmox.proxmox_cluster_ha_rules_info:
    type: node-affinity
    resource: vm:100

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

rules

list / elements=dictionary

HA rules

Returned: on success

affinity

string

The affinity type

Returned: on success, when rule type is resource-affinity

Sample: "positive"

comment

string

A comment associated with the rule.

Returned: on success

Sample: "Prefer pve-001 for these VMs"

disable

boolean

Whether the HA rule is disabled.

Returned: on success

Sample: false

nodes

list / elements=string

A list of cluster node names and their priorities (if configured, otherwise only the node name is returned)

Returned: on success, when rule type is node-affinity

Sample: ["pve-001:1", "pve-002:2", "pve-003"]

order

integer

The rule position.

Returned: on success

Sample: 1

resources

list / elements=string

A list of HA resource IDs that this rule applies to.

Returned: on success

Sample: ["vm:100", "ct:101"]

rule

string

The name of the HA rule.

Returned: on success

Sample: "prefer-pve-001"

strict

boolean

Whether the node affinity rule is strict.

Returned: on success, when rule type is node-affinity

Sample: false

type

string

The HA rule type

Returned: on success

Sample: "node-affinity"

Authors

  • Clément Cruau (@PendaGTP)