Added support for single-node setups

This commit is contained in:
Francesco Zimbolo
2026-04-23 08:18:49 +00:00
parent 861a468fc7
commit 251a8f7f64

View File

@@ -6,6 +6,10 @@
any_errors_fatal: true any_errors_fatal: true
vars: vars:
# Dynamically detect if we are in Single-Node or Cluster mode
is_single_node: "{{ groups['proxmox'] | length == 1 }}"
# Existing clustering variables
corosync_ip: "{{ priv_ip | default(ansible_host) }}" corosync_ip: "{{ priv_ip | default(ansible_host) }}"
master_corosync_ip: "{{ hostvars[groups['proxmox'][0]]['priv_ip'] | default(hostvars[groups['proxmox'][0]]['ansible_host']) }}" master_corosync_ip: "{{ hostvars[groups['proxmox'][0]]['priv_ip'] | default(hostvars[groups['proxmox'][0]]['ansible_host']) }}"
is_master: "{{ inventory_hostname == groups['proxmox'][0] }}" is_master: "{{ inventory_hostname == groups['proxmox'][0] }}"
@@ -33,10 +37,12 @@
state: "{{ 'absent' if pve_enterprise_key | length > 0 else 'present' }}" state: "{{ 'absent' if pve_enterprise_key | length > 0 else 'present' }}"
filename: pve-no-subscription filename: pve-no-subscription
- name: Add Linstor Repositories - name: Add Linstor Repositories (Skipped in Single Node)
ansible.builtin.include_role: ansible.builtin.include_role:
name: linstor_repo name: linstor_repo
when: deploy_linstor | bool when:
- deploy_linstor | bool
- not is_single_node | bool
# ========================================== # ==========================================
# PHASE 2: UPDATES & NAG REMOVAL # PHASE 2: UPDATES & NAG REMOVAL
@@ -55,10 +61,12 @@
replace: "void({ //\\1" replace: "void({ //\\1"
notify: Restart pveproxy notify: Restart pveproxy
- name: Install Linstor Packages - name: Install Linstor Packages (Skipped in Single Node)
ansible.builtin.include_role: ansible.builtin.include_role:
name: linstor_install name: linstor_install
when: deploy_linstor | bool when:
- deploy_linstor | bool
- not is_single_node | bool
- name: Reboot if kernel was updated - name: Reboot if kernel was updated
ansible.builtin.reboot: ansible.builtin.reboot:
@@ -68,6 +76,9 @@
# ========================================== # ==========================================
# PHASE 3: PROXMOX CLUSTERING # PHASE 3: PROXMOX CLUSTERING
# ========================================== # ==========================================
- name: PROXMOX CLUSTERING (Skipped in Single Node Mode)
when: not is_single_node | bool
block:
- name: Ensure SSH keypair exists for root - name: Ensure SSH keypair exists for root
ansible.builtin.user: ansible.builtin.user:
name: root name: root
@@ -127,8 +138,10 @@
# ========================================== # ==========================================
# PHASE 4: LINSTOR CONFIGURATION # PHASE 4: LINSTOR CONFIGURATION
# ========================================== # ==========================================
- name: Configure Linstor (Skipped if deploy_linstor=false) - name: LINSTOR CONFIGURATION (Skipped if deploy_linstor=false or Single Node)
when: deploy_linstor | bool when:
- deploy_linstor | bool
- not is_single_node | bool
block: block:
- name: Configure Linstor Cluster - name: Configure Linstor Cluster
ansible.builtin.include_role: ansible.builtin.include_role: