Skip to content

Commit b26e8e7

Browse files
committed
Use _init_node instead of groups[pve_group][0] for all configuration tasks
1 parent e7410bd commit b26e8e7

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

tasks/main.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -208,23 +208,23 @@
208208
state: "{{ item.state | default('present') }}"
209209
comment: "{{ item.comment | default(omit) }}"
210210
with_items: "{{ pve_pools }}"
211-
when: "not pve_cluster_enabled or (pve_cluster_enabled | bool and inventory_hostname == groups[pve_group][0])"
211+
when: "not pve_cluster_enabled or (pve_cluster_enabled | bool and inventory_hostname == _init_node)"
212212

213213
- name: Configure Proxmox roles
214214
proxmox_role:
215215
name: "{{ item.name }}"
216216
privileges: "{{ item.privileges }}"
217217
state: "{{ item.state | default('present') }}"
218218
with_items: "{{ pve_roles }}"
219-
when: "not pve_cluster_enabled | bool or (pve_cluster_enabled | bool and inventory_hostname == groups[pve_group][0])"
219+
when: "not pve_cluster_enabled | bool or (pve_cluster_enabled | bool and inventory_hostname == _init_node)"
220220

221221
- name: Configure Proxmox groups
222222
proxmox_group:
223223
name: "{{ item.name }}"
224224
state: "{{ item.state | default('present') }}"
225225
comment: "{{ item.comment | default(omit) }}"
226226
with_items: "{{ pve_groups }}"
227-
when: "not pve_cluster_enabled or (pve_cluster_enabled | bool and inventory_hostname == groups[pve_group][0])"
227+
when: "not pve_cluster_enabled or (pve_cluster_enabled | bool and inventory_hostname == _init_node)"
228228

229229
- name: Configure Proxmox user accounts
230230
proxmox_user:
@@ -239,7 +239,7 @@
239239
password: "{{ item.password | default(omit) }}"
240240
expire: "{{ item.expire | default(omit) }}"
241241
with_items: "{{ pve_users }}"
242-
when: "not pve_cluster_enabled | bool or (pve_cluster_enabled | bool and inventory_hostname == groups[pve_group][0])"
242+
when: "not pve_cluster_enabled | bool or (pve_cluster_enabled | bool and inventory_hostname == _init_node)"
243243

244244
- name: Configure Proxmox ACLs
245245
proxmox_acl:
@@ -249,7 +249,7 @@
249249
groups: "{{ item.groups | default([]) }}"
250250
users: "{{ item.users | default([]) }}"
251251
with_items: "{{ pve_acls }}"
252-
when: "not pve_cluster_enabled | bool or (pve_cluster_enabled | bool and inventory_hostname == groups[pve_group][0])"
252+
when: "not pve_cluster_enabled | bool or (pve_cluster_enabled | bool and inventory_hostname == _init_node)"
253253

254254
- name: Create ZFS Pools
255255
zfs:
@@ -287,15 +287,15 @@
287287
thinpool: "{{ item.thinpool | default(omit) }}"
288288
sparse: "{{ item.sparse | default(omit) }}"
289289
with_items: "{{ pve_storages }}"
290-
when: "not pve_cluster_enabled | bool or (pve_cluster_enabled | bool and inventory_hostname == groups[pve_group][0])"
290+
when: "not pve_cluster_enabled | bool or (pve_cluster_enabled | bool and inventory_hostname == _init_node)"
291291
tags: storage
292292

293293
- name: Check datacenter.cfg exists
294294
stat:
295295
path: "/etc/pve/datacenter.cfg"
296296
register: _datacenter_cfg
297297
when:
298-
- "not pve_cluster_enabled | bool or (pve_cluster_enabled | bool and inventory_hostname == groups[pve_group][0])"
298+
- "not pve_cluster_enabled | bool or (pve_cluster_enabled | bool and inventory_hostname == _init_node)"
299299
- "pve_datacenter_cfg | length > 0"
300300

301301
- name: Create datacenter.cfg if it does not exist
@@ -304,7 +304,7 @@
304304
state: "touch"
305305
mode: 0640
306306
when:
307-
- "not pve_cluster_enabled | bool or (pve_cluster_enabled | bool and inventory_hostname == groups[pve_group][0])"
307+
- "not pve_cluster_enabled | bool or (pve_cluster_enabled | bool and inventory_hostname == _init_node)"
308308
- "pve_datacenter_cfg | length > 0"
309309
- "not _datacenter_cfg.stat.exists"
310310

@@ -319,7 +319,7 @@
319319
{{ k }}: {{ v }}
320320
{% endfor %}
321321
when:
322-
- "not pve_cluster_enabled | bool or (pve_cluster_enabled | bool and inventory_hostname == groups[pve_group][0])"
322+
- "not pve_cluster_enabled | bool or (pve_cluster_enabled | bool and inventory_hostname == _init_node)"
323323
- "pve_datacenter_cfg | length > 0"
324324

325325
- import_tasks: ssl_config.yml

0 commit comments

Comments
 (0)