added backup support

This commit is contained in:
nd 2020-04-19 11:52:58 +02:00
parent b8f4b6d206
commit 78231abc44
No known key found for this signature in database
GPG key ID: 21B5CD4DEE3670E9
3 changed files with 27 additions and 21 deletions

View file

@ -38,27 +38,9 @@
hour: 23
minute: 26
- name: add postgresql backup folder
file:
path: /opt/postgresbackup/
state: directory
owner: postgres
group: postgres
mode: '750'
- name: add backup cronjob for easier backup/restore
cron:
name: db backup
job: '/usr/bin/pg_dumpall | gzip > /opt/postgresbackup/$(date "+\%Y\%m\%d-\%H\%M.sql.gz")'
user: postgres
hour: "*/4"
minute: 45
- name: add backup cleanup cronjob
cron:
name: db backup cleanup
job: 'find /opt/postgresbackup/* -mtime +3 -type f -exec rm {} \;'
special_time: daily
- include_tasks: backup.yml
when:
- postgresql.backup.enable
- name: flush handlers so postgres is ready before other roles try to use it
meta: flush_handlers