Skip to content

Commit

Permalink
Use _init_node instead of groups[pve_group][0] for all configurat…
Browse files Browse the repository at this point in the history
…ion tasks
  • Loading branch information
lae committed Mar 15, 2024
1 parent e7410bd commit b26e8e7
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -208,23 +208,23 @@
state: "{{ item.state | default('present') }}"
comment: "{{ item.comment | default(omit) }}"
with_items: "{{ pve_pools }}"
when: "not pve_cluster_enabled or (pve_cluster_enabled | bool and inventory_hostname == groups[pve_group][0])"
when: "not pve_cluster_enabled or (pve_cluster_enabled | bool and inventory_hostname == _init_node)"

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

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

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

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

- name: Create ZFS Pools
zfs:
Expand Down Expand Up @@ -287,15 +287,15 @@
thinpool: "{{ item.thinpool | default(omit) }}"
sparse: "{{ item.sparse | default(omit) }}"
with_items: "{{ pve_storages }}"
when: "not pve_cluster_enabled | bool or (pve_cluster_enabled | bool and inventory_hostname == groups[pve_group][0])"
when: "not pve_cluster_enabled | bool or (pve_cluster_enabled | bool and inventory_hostname == _init_node)"
tags: storage

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

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

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

- import_tasks: ssl_config.yml
Expand Down

0 comments on commit b26e8e7

Please sign in to comment.