2019-08-14 16:02:02 +02:00
|
|
|
---
|
|
|
|
# tasks file for skeleton
|
|
|
|
|
|
|
|
- name: Create backup script
|
|
|
|
template:
|
2019-08-14 16:03:03 +02:00
|
|
|
src: restic_script_Linux.j2
|
2019-08-14 16:02:02 +02:00
|
|
|
dest: '{{ restic_script_dir }}/backup-{{ item.name }}.sh'
|
|
|
|
mode: '0700'
|
|
|
|
owner: '{{ restic_dir_owner }}'
|
|
|
|
group: '{{ restic_dir_group }}'
|
2019-08-14 16:59:32 +02:00
|
|
|
no_log: true
|
2019-08-14 16:02:02 +02:00
|
|
|
with_items: '{{ restic_backups }}'
|
|
|
|
when:
|
|
|
|
- item.name is defined
|
2019-08-15 08:36:57 +02:00
|
|
|
- item.src is defined or item.stdin is defined
|
2019-08-15 10:00:45 +02:00
|
|
|
- item.src is defined or item.stdin and item.stdin_cmd is defined
|
2019-08-14 16:59:32 +02:00
|
|
|
- item.repo in restic_repos
|
2019-08-15 14:47:55 +02:00
|
|
|
|
|
|
|
- name: Setup CRON jobs
|
|
|
|
cron:
|
|
|
|
name: 'arillso.restic backup {{ item.name }}'
|
|
|
|
job: 'CRON=true {{ restic_script_dir }}/backup-{{ item.name }}.sh'
|
|
|
|
minute: '{{ schedule_minute | default("*") }}'
|
|
|
|
hour: '{{ schedule_hour | default("*") }}'
|
|
|
|
weekday: '{{ schedule_weekday | default("*") }}'
|
|
|
|
month: '{{ schedule_month | default("*") }}'
|
|
|
|
state: present
|
2019-08-15 14:51:42 +02:00
|
|
|
become: true
|
2019-08-15 14:52:43 +02:00
|
|
|
no_log: true
|
2019-08-15 14:47:55 +02:00
|
|
|
when:
|
|
|
|
- restic_create_cron
|
|
|
|
- item.name is defined
|
|
|
|
- item.scheduled
|
2019-08-15 14:51:42 +02:00
|
|
|
with_items: '{{ restic_backups }}'
|