2023-10-25 22:26:17 +02:00
|
|
|
---
|
|
|
|
- name: check which storages exists
|
|
|
|
become: true
|
|
|
|
ansible.builtin.shell:
|
|
|
|
cmd: "set -o pipefail && pvesm status | awk '{ print $1}'"
|
|
|
|
executable: /bin/bash
|
|
|
|
register: storages
|
|
|
|
changed_when: false
|
|
|
|
|
|
|
|
- name: ensure datastore exist # noqa no-changed-when
|
|
|
|
become: true
|
|
|
|
ansible.builtin.command: "pvesm add pbs {{ item.name }} --server {{ item.server }} --datastore {{ item.datastore }} --username {{ item.username }} --password {{ item.password }} --fingerprint {{ item.fingerprint }}"
|
|
|
|
loop: "{{ pve_pbs_datastore }}"
|
|
|
|
when: "item.name not in storages.stdout"
|
2024-07-09 17:35:56 +02:00
|
|
|
no_log: true
|
2023-10-25 22:26:17 +02:00
|
|
|
|
|
|
|
- name: ensure datastore is configured
|
|
|
|
become: true
|
|
|
|
ansible.builtin.command: "pvesm set {{ item.name }} --username {{ item.username }} --password {{ item.password }}"
|
|
|
|
loop: "{{ pve_pbs_datastore }}"
|
|
|
|
when: "item.name in storages.stdout"
|
|
|
|
changed_when: false
|
2024-07-09 17:35:56 +02:00
|
|
|
no_log: true
|