homeserver/roles/mgrote.pbs_users/tasks/main.yml
mg 154fc0ef58 neuer Backup-Server (pbs) (#538)
Co-authored-by: Michael Grote <michael.grote@posteo.de>
Reviewed-on: #538
2023-06-23 16:04:19 +02:00

25 lines
863 B
YAML

---
- name: check which users exist
become: yes
ansible.builtin.command: "proxmox-backup-manager user list --output-format json"
register: users
changed_when: false
- name: ensure users exist
become: yes
ansible.builtin.command: "proxmox-backup-manager user create {{ item.name }}@{{ item.realm }}"
loop: "{{ pbs_users }}"
when: "item.name not in users.stdout"
- name: check again which users exist
become: yes
ansible.builtin.command: "proxmox-backup-manager user list --output-format json"
register: users
changed_when: false
- name: ensure user password
become: yes
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