--- # tasks file for proxmox_storage - name: Create a safety backup of Proxmox storage.cfg ansible.builtin.copy: src: /etc/pve/storage.cfg dest: "/root/pve_storage.cfg.bak.{{ ansible_facts['date_time']['epoch'] }}" remote_src: true mode: '0600' when: inventory_hostname == groups['proxmox'][0] - name: Register LINSTOR resource groups in Proxmox GUI (pvesm) ansible.builtin.shell: | set -o pipefail # We use the ha_vip variable, but gracefully fallback to Node 1's public IP if it's undefined CONTROLLER="{{ ha_vip | default(hostvars[groups['proxmox'][0]].ansible_host) }}" STORAGE_ID="ls-{{ item.rg_name }}" if ! pvesm status | grep -q "^${STORAGE_ID} "; then pvesm add drbd "${STORAGE_ID}" --controller "${CONTROLLER}" --resourcegroup "{{ item.rg_name }}" --content images,rootdir > /dev/null echo "changed" fi args: executable: /bin/bash register: proxmox_storage_pvesm_add changed_when: "'changed' in proxmox_storage_pvesm_add.stdout" loop: "{{ linstor_storage_pools }}" when: inventory_hostname == groups['proxmox'][0]