community.proxmox.proxmox_cluster_ha_rules module – Management of HA rules
Note
This module is part of the community.proxmox collection (version 1.4.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 |
|---|---|
Describes whether the HA resource are supposed to be kept on the same node Choices:
|
|
Specify the target host of the Proxmox VE cluster. Uses the |
|
Specify the password to authenticate with. Uses the |
|
Specify the target port of the Proxmox VE cluster. Uses the |
|
Specify the token ID. Uses the |
|
Specify the token secret. Uses the |
|
Specify the user to authenticate with. Uses the |
|
Description |
|
Whether the HA rule is disabled. If not specified, the Proxmox API default Choices:
|
|
Existing rules with a specific Choices:
|
|
HA rule identifier. |
|
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 |
|
List of HA resource IDs. It can either be a string |
|
create or delete rule Choices:
|
|
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:
|
|
HA rule type. Choices:
|
|
If This should only be used on personally controlled sites using self-signed certificates. Uses the Choices:
|
Attributes
Attribute |
Support |
Description |
|---|---|---|
Action group: community.proxmox.proxmox |
Use |
|
Support: full |
Can run in |
|
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 |
|---|---|
A representation of the rule. Returned: success Sample: |