community.proxmox.proxmox_cluster_ha_rules module – Management of HA rules
Note
This module is part of the community.proxmox collection (version 1.6.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.
New in community.proxmox 1.4.0
Synopsis
- Configure ha rules
/cluster/ha/rules.
Requirements
The below requirements are needed on the host that executes this module.
- proxmoxer >= 2.0
- requests
Parameters
Parameter | Comments |
|---|---|
affinity string | Describes whether the HA resource are supposed to be kept on the same node Choices:
|
api_host string / required | Specify the target host of the Proxmox VE cluster. Uses the |
api_password string | Specify the password to authenticate with. Uses the |
api_port integer | Specify the target port of the Proxmox VE cluster. Uses the |
api_timeout integer | Time limit for requests towards the Proxmox VE API. Default: |
api_token_id string | Specify the token ID. Uses the |
api_token_secret string | Specify the token secret. Uses the |
api_user string / required | Specify the user to authenticate with. Uses the |
ca_path path | Path to a local certificate, which will be used to verify TLS connections. Ignored if |
comment string | Description |
disable boolean | Whether the HA rule is disabled. If not specified, the Proxmox API default Choices:
|
force boolean | Existing rules with a specific Choices:
|
name string / required | HA rule identifier. |
nodes list / elements=string | List of cluster node members, where a priority can be given to each node. A resource bound to a group will run on the available nodes with the highest priority. If there are more nodes in the highest priority class, the services will get distributed to those nodes. The priorities have a relative meaning only. The higher the number, the higher the priority. It can either be a string |
resources list / elements=string | List of HA resource IDs. It can either be a string |
state string / required | create or delete rule Choices:
|
strict boolean | If false, the HA resource can also be moved to other nodes if there is none of the specified nodes available. If not specified, the Proxmox API default Choices:
|
type string | HA rule type. Choices:
|
validate_certs boolean | Validate the TLS certificates used for the connection to the Proxmox VE API. Currently defaults to Uses the Choices:
|
Attributes
Attribute | Support | Description |
|---|---|---|
action_group | Action group: community.proxmox.proxmox | Use |
check_mode | Support: full | Can run in |
diff_mode | Support: full | Will return details on what has changed (or possibly needs changing in |
Examples
- name: Configure ha rule (node-affinity)
community.proxmox.proxmox_cluster_ha_rules:
api_host: "{{ proxmox_api_host }}"
api_user: "{{ proxmox_api_user }}"
api_token_id: "{{ proxmox_api_token_id }}"
api_token_secret: "{{ proxmox_api_token_secret }}"
name: node-affinity-rule-1
state: present
type: node-affinity
comment: VM 100 is supposed run on proxmox02
nodes:
- proxmox01:10
- proxmox02:20
resources:
- vm:100
disable: false
delegate_to: localhost
- name: Configure ha rule (node-affinity) - nodes and resources can also be provided as str
community.proxmox.proxmox_cluster_ha_rules:
api_host: "{{ proxmox_api_host }}"
api_user: "{{ proxmox_api_user }}"
api_token_id: "{{ proxmox_api_token_id }}"
api_token_secret: "{{ proxmox_api_token_secret }}"
name: node-affinity-rule-2
state: present
type: node-affinity
comment: VM 100 is supposed to run on proxmox02
nodes: proxmox01:10,proxmox02:20
resources: vm:100
disable: false
delegate_to: localhost
- name: Configure ha rule (resource-affinity) - resource affinity
community.proxmox.proxmox_cluster_ha_rules:
api_host: "{{ proxmox_api_host }}"
api_user: "{{ proxmox_api_user }}"
api_token_id: "{{ proxmox_api_token_id }}"
api_token_secret: "{{ proxmox_api_token_secret }}"
name: resource-affinity-rule-1
state: present
type: resource-affinity
comment: VM 100 and 101 are supposed to be kept on the same node
affinity: positive
resources:
- vm:100
- vm:101
disable: false
delegate_to: localhost
- name: Configure ha rule (resource-affinity) - resource anti-affinity
community.proxmox.proxmox_cluster_ha_rules:
api_host: "{{ proxmox_api_host }}"
api_user: "{{ proxmox_api_user }}"
api_token_id: "{{ proxmox_api_token_id }}"
api_token_secret: "{{ proxmox_api_token_secret }}"
name: resource-affinity-rule-1
state: present
type: resource-affinity
comment: VM 100 and 101 are supposed to be kept on different nodes
affinity: negative
resources:
- vm:100
- vm:101
disable: false
delegate_to: localhost
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key | Description |
|---|---|
rule dictionary | A representation of the rule. Returned: success Sample: |
Collection links
© 2012–2018 Michael DeHaan
© 2018–2025 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/projects/ansible/latest/collections/community/proxmox/proxmox_cluster_ha_rules_module.html