add cron config

This commit is contained in:
Luc Stroobant 2017-10-01 20:01:19 +02:00
parent a1209ca8c2
commit 6bd9aeb627
3 changed files with 17 additions and 3 deletions

View File

@ -45,6 +45,14 @@ host\_vars\client1:
borgbackup_passphrase: Ahl9EiNohr5koosh1Wohs3Shoo3ooZ6p borgbackup_passphrase: Ahl9EiNohr5koosh1Wohs3Shoo3ooZ6p
``` ```
Per default the role creates a cronjob in /etc/cron.d/borg-backup running as root every day on a random hour between 0 and 5am on a random minute. Override the defaults if necessary:
```
borgbackup_cron_user: root
borgbackup_cron_day: "*"
borgbackup_cron_hour: "{{ 59|random }}"
borgbackup_cron_minute: "{{ 5|random }}"
```
Set borgbackup\_appendonly: True in host or group vars if you want append-only repositories. In that case it's possible to define a hostname in borgbackup\_management\_station where a borg prune script will be configured. Set borgbackup\_appendonly: True in host or group vars if you want append-only repositories. In that case it's possible to define a hostname in borgbackup\_management\_station where a borg prune script will be configured.
*Make sure to check the configured defaults for this role, which contains the list of default locations being backed up in backup_include.* Override this in your inventory where required. *Make sure to check the configured defaults for this role, which contains the list of default locations being backed up in backup_include.* Override this in your inventory where required.

View File

@ -22,6 +22,11 @@ borgbackup_retention:
monthly: 6 monthly: 6
yearly: 1 yearly: 1
borgbackup_cron_user: root
borgbackup_cron_day: "*"
borgbackup_cron_hour: "{{ 59|random }}"
borgbackup_cron_minute: "{{ 5|random }}"
borgbackup_appendonly: False borgbackup_appendonly: False
borgbackup_management_station: '' borgbackup_management_station: ''
borgbackup_management_user: '' borgbackup_management_user: ''

View File

@ -89,10 +89,11 @@
- name: client | create backup cronjob - name: client | create backup cronjob
cron: cron:
cron_file: "borg-backup" cron_file: "borg-backup"
user: "root" user: "{{ borgbackup_cron_user }}"
name: "borg-backup" name: "borg-backup"
minute: "{{ 59|random }}" minute: "{{ borgbackup_cron_minute }}"
hour: "{{ 5|random }}" hour: "{{ borgbackup_cron_hour }}"
day: "{{ borgbackup_cron_day }}"
job: "/usr/local/bin/borg-backup backup" job: "/usr/local/bin/borg-backup backup"
- name: client | disable automysqlbackup cronjob, it's in our pre-backup-tasks - name: client | disable automysqlbackup cronjob, it's in our pre-backup-tasks