added backup support
This commit is contained in:
parent
b8f4b6d206
commit
78231abc44
3 changed files with 27 additions and 21 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue