ansible/roles/unhb_backup_location/tasks/main.yml

39 lines
897 B
YAML
Raw Normal View History

---
- name: "Ensure the groups for the backups users exists"
ansible.builtin.group:
name: "{{ item }}"
state: present
with_items:
- restic_unhb2
- restic_unhb4
- name: "Ensure the backup users for restic exist"
ansible.builtin.user:
name: "{{ item }}"
groups: "{{ item }}"
append: yes
with_items:
- restic_unhb2
- restic_unhb4
- name: "Set authorized keys for restic_unhb2"
ansible.posix.authorized_key:
user: "restic_unhb2"
state: present
key: "{{ lookup('file', '{{ keys_item }}') }}"
with_fileglob:
- ../ssh_pub_keys/*.pub
loop_control:
loop_var: keys_item
- name: "Set authorized keys for restic_unhb4"
ansible.posix.authorized_key:
user: "restic_unhb4"
state: present
key: "{{ lookup('file', '{{ keys_item }}') }}"
with_fileglob:
- ../ssh_pub_keys/*.pub
loop_control:
loop_var: keys_item