added backup cronjobs
This commit is contained in:
parent
26e2ec23de
commit
1a73441d47
1 changed files with 22 additions and 0 deletions
|
|
@ -38,5 +38,27 @@
|
||||||
hour: 23
|
hour: 23
|
||||||
minute: 26
|
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 "+%s-%Y%M%d-%H%M.sql.gz")'
|
||||||
|
user: postgres
|
||||||
|
hour: 5,11,17,23
|
||||||
|
minute: 45
|
||||||
|
|
||||||
|
- name: add backup cleanup cronjob
|
||||||
|
cron:
|
||||||
|
name: db backup cleanup
|
||||||
|
job: 'find /opt/postgresbackup/* -mtime +9 -type f -exec rm {} \;'
|
||||||
|
special_time: daily
|
||||||
|
|
||||||
- name: flush handlers so postgres is ready before other roles try to use it
|
- name: flush handlers so postgres is ready before other roles try to use it
|
||||||
meta: flush_handlers
|
meta: flush_handlers
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue