1
0
Fork 0
mirror of https://github.com/roles-ansible/ansible_role_restic.git synced 2024-12-11 23:41:32 +01:00
ansible_role_restic/tasks/backup.yml
2024-04-04 07:27:05 -04:00

36 lines
1.3 KiB
YAML

---
- name: (BACKUP) reformat dict if necessary
ansible.builtin.set_fact:
restic_backups: "{{ restic_backups | default([]) | map('extract', restic_backups) | list }}"
when:
- restic_backups | type_debug == "dict"
- name: (BACKUP) Create backup credentials
ansible.builtin.template:
src: restic_access_Linux.j2
dest: "{{ restic_script_dir }}/access-{{ item.name | replace(' ', '') }}.sh"
mode: '0700'
owner: '{{ restic_dir_owner }}'
group: '{{ restic_dir_group }}'
no_log: "{{ restic_no_log }}"
with_items: '{{ restic_backups }}'
when:
- item.name is defined
- item.src is defined or item.stdin is defined
- item.src is defined or item.stdin and item.stdin_cmd is defined
- item.repo in restic_repos
- name: (BACKUP) Create backup script
ansible.builtin.template:
src: restic_script_Linux.j2
dest: "{{ restic_script_dir }}/backup-{{ item.name | replace(' ', '') }}.sh"
mode: '0700'
owner: '{{ restic_dir_owner }}'
group: '{{ restic_dir_group }}'
no_log: "{{ restic_no_log }}"
with_items: '{{ restic_backups }}'
when:
- item.name is defined
- item.src is defined or item.stdin is defined
- item.src is defined or item.stdin and item.stdin_cmd is defined
- item.repo in restic_repos