Skip to content

Commit

Permalink
Fix host used to configure HA groups
Browse files Browse the repository at this point in the history
When the role is run with `--limit nodes_without_first_node`, the HA
groups are not configured (tasks are skipped). Use `_init_node` instead
of `groups[pve_group][0]` to run the tasks.

`_init_node` is any active node in an already initialized Proxmox
cluster which is part of the run.
  • Loading branch information
btravouillon committed Feb 18, 2023
1 parent 569a203 commit e7410bd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tasks/pve_cluster_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
proxmox_query:
query: "/cluster/ha/groups"
register: _ha_group_list
when: "inventory_hostname == groups[pve_group][0]"
when: "inventory_hostname == _init_node"

- name: Create PVE cluster HA groups
command: >-
Expand All @@ -94,15 +94,15 @@
-restricted {{ item.restricted }}
{% endif %}
when:
- "inventory_hostname == groups[pve_group][0]"
- "inventory_hostname == _init_node"
- item.name not in _ha_group_list.response | json_query("[*].group")
with_items: "{{ pve_cluster_ha_groups }}"

- name: Update PVE cluster HA groups
command: >-
ha-manager groupset {{ item.0.name }} -{{ item.1 }} "{{ item.0[item.1] }}"
when:
- "inventory_hostname == groups[pve_group][0]"
- "inventory_hostname == _init_node"
- item.0.name in _ha_group_list.response | json_query("[*].group")
- item.1 in item.0
- item.0[item.1] != _ha_group_list.response
Expand Down

0 comments on commit e7410bd

Please sign in to comment.