crontab hourly step postgres backup

This commit is contained in:
Tommaso Piccioli 2019-12-06 17:33:06 +01:00
parent 10e03416aa
commit c6228c8255
1 changed files with 18 additions and 3 deletions

View File

@ -1,11 +1,26 @@
---
- name: Backup script for the postgresql database(s)
copy: src=postgresql-backup.sh dest=/usr/local/sbin/postgresql-backup owner=root mode=0744
tags: [ 'pg_backup', 'postgresql', 'postgres' ]
copy: src=postgresql-backup.cron dest=/usr/local/sbin/postgresql-backup.cron owner=root mode=0744
tags: [ 'pgbackup_cron', 'pg_backup', 'postgresql', 'postgres' ]
- name: cron job for the postgresql database(s) backup
- name: daily cron job for the postgresql database(s) backup
copy: src=postgresql-backup.cron dest=/etc/cron.daily/postgresql-backup owner=root mode=0744
tags: [ 'pg_backup', 'postgresql', 'postgres' ]
when: pgbackup_cron_step is undefined or
pgbackup_cron_step < 1 or
pgbackup_cron_step > 12
tags: [ 'pgbackup_cron', 'pg_backup', 'postgresql', 'postgres' ]
- name: hour step cron job for the postgresql database(s) backup
cron:
name: "hourly step postgresql dump"
minute: "10"
hour: "*/{{ pgbackup_cron_step }}"
job: "/usr/local/sbin/postgresql-backup.cron"
when: pgbackup_cron_step is defined and
pgbackup_cron_step >=1 and
pgbackup_cron_step <= 12
tags: [ 'pgbackup_cron', 'pg_backup', 'postgresql', 'postgres' ]
- name: postgresql backup defaults
template: src=pg_backup-default.j2 dest=/etc/default/pg_backup owner=root mode=0744