homeserver/roles/mgrote_pbs_pve_integration/tasks/main.yml
Michael Grote bc6f8fdc9e
All checks were successful
ansible-lint / gitleaks (push) Successful in 5s
ansible-lint / Ansible Lint (push) Successful in 1m0s
add no_log as global variable (#233)
Reviewed-on: #233
Co-authored-by: Michael Grote <michael.grote@posteo.de>
Co-committed-by: Michael Grote <michael.grote@posteo.de>
2024-11-10 15:56:59 +01:00

23 lines
934 B
YAML

---
- 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"
no_log: "{{ no_debug | default('true') }}"
- 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
no_log: "{{ no_debug | default('true') }}"