homeserver/roles/mgrote_pbs_users/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

27 lines
938 B
YAML

---
- name: check which users exist
become: true
ansible.builtin.command: "proxmox-backup-manager user list --output-format json"
register: users
changed_when: false
- name: ensure users exist # noqa no-changed-when
become: true
ansible.builtin.command: "proxmox-backup-manager user create {{ item.name }}@{{ item.realm }}"
loop: "{{ pbs_users }}"
when: "item.name not in users.stdout"
no_log: "{{ no_debug | default('true') }}"
- name: check again which users exist
become: true
ansible.builtin.command: "proxmox-backup-manager user list --output-format json"
register: users
changed_when: false
- name: ensure user password
become: true
ansible.builtin.command: "proxmox-backup-manager user update {{ item.name }}@{{ item.realm }} --password {{ item.password }} --expire 0"
loop: "{{ pbs_users }}"
when: "item.name in users.stdout"
changed_when: false
no_log: "{{ no_debug | default('true') }}"