mirror of
https://github.com/roles-ansible/ansible_role_restic.git
synced 2024-12-11 23:41:32 +01:00
adds cronjobs for Linux, closes #3
This commit is contained in:
parent
e5511b7b97
commit
3d89fa80c6
2 changed files with 38 additions and 17 deletions
11
README.md
11
README.md
|
@ -112,9 +112,9 @@ Repository defined in `restic_repos`.
|
||||||
|
|
||||||
Available variables:
|
Available variables:
|
||||||
|
|
||||||
| Name | Required | Description |
|
| Name | Required (Default) | Description |
|
||||||
| ---------------- |:-----------------------------:| ----------------------------------------------------------------------------------------------------------------------- |
|
| ------------------ |:-----------------------------:| ----------------------------------------------------------------------------------------------------------------------- |
|
||||||
| `name` | yes | The name of this backup. Used together with pruning and needs to be unique. |
|
| `name` | yes | The name of this backup. Used together with pruning and scheduling and needs to be unique. |
|
||||||
| `repo` | yes | The name of the repository to backup to. |
|
| `repo` | yes | The name of the repository to backup to. |
|
||||||
| `src` | yes | The source directory or file |
|
| `src` | yes | The source directory or file |
|
||||||
| `stdin` | no | Is this backup created from a [stdin](https://restic.readthedocs.io/en/stable/040_backup.html#reading-data-from-stdin)? |
|
| `stdin` | no | Is this backup created from a [stdin](https://restic.readthedocs.io/en/stable/040_backup.html#reading-data-from-stdin)? |
|
||||||
|
@ -129,6 +129,11 @@ Available variables:
|
||||||
| `keep_yearly ` | no | If set, only keeps the last n yearly snapshots. |
|
| `keep_yearly ` | no | If set, only keeps the last n yearly snapshots. |
|
||||||
| `keep_within` | no | If set, only keeps snapshots in this time period. |
|
| `keep_within` | no | If set, only keeps snapshots in this time period. |
|
||||||
| `keep_tag` | no | If set, keep snapshots with this tags. |
|
| `keep_tag` | no | If set, keep snapshots with this tags. |
|
||||||
|
| `scheduled` | no (`false`) | If `restic_create_cron` is set to `true`, this backup is scheduled. |
|
||||||
|
| `schedule_minute` | no (`*`) | Minute when the job is run. ( 0-59, *, */2, etc ) |
|
||||||
|
| `schedule_hour` | no (`*`) | Hour when the job is run. ( 0-23, *, */2, etc ) |
|
||||||
|
| `schedule_weekday` | no (`*`) | Weekday when the job is run. ( 0-6 for Sunday-Saturday, *, etc ) |
|
||||||
|
| `schedule_month` | no (`*`) | Month when the job is run. ( 1-12, *, */2, etc ) |
|
||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
none
|
none
|
||||||
|
|
|
@ -15,3 +15,19 @@
|
||||||
- item.src is defined or item.stdin 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.src is defined or item.stdin and item.stdin_cmd is defined
|
||||||
- item.repo in restic_repos
|
- item.repo in restic_repos
|
||||||
|
|
||||||
|
- 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
|
||||||
|
become: yes
|
||||||
|
when:
|
||||||
|
- restic_create_cron
|
||||||
|
- item.name is defined
|
||||||
|
- item.scheduled
|
||||||
|
with_items: '{{ restic_backups }}'
|
Loading…
Reference in a new issue