diff --git a/ansible/roles/proxmox_storage/tasks/main.yml b/ansible/roles/proxmox_storage/tasks/main.yml index 33ce2f8..1ac74f2 100644 --- a/ansible/roles/proxmox_storage/tasks/main.yml +++ b/ansible/roles/proxmox_storage/tasks/main.yml @@ -9,6 +9,24 @@ mode: '0600' when: inventory_hostname == groups['proxmox'][0] +- name: Prevent Split-Brain by removing default local-lvm if managed by Linstor + ansible.builtin.shell: | + set -o pipefail + # Check if local-lvm is currently registered in Proxmox + if pvesm status | grep -q "^local-lvm "; then + pvesm remove local-lvm + echo "changed" + fi + args: + executable: /bin/bash + register: proxmox_storage_remove_local_lvm + changed_when: "'changed' in proxmox_storage_remove_local_lvm.stdout" + loop: "{{ linstor_storage_pools }}" + # Only run on Node 1, and ONLY if the loop detects the usage of the pve/data pool + when: + - inventory_hostname == groups['proxmox'][0] + - (item.vg_name == 'pve' and item.thin_name == 'data') or ('pve/data' in item.targets.values()) + - name: Register LINSTOR resource groups in Proxmox GUI (pvesm) ansible.builtin.shell: | set -o pipefail