Cron backups for db-datanommer01.
This commit is contained in:
parent
18100deb21
commit
12b88b57a1
4 changed files with 21 additions and 0 deletions
|
@ -32,3 +32,16 @@
|
|||
- restart postgresql
|
||||
tags:
|
||||
- config
|
||||
|
||||
- name: Ensure postgres has a place to backup to
|
||||
file: dest=/backups state=directory owner=postgres
|
||||
|
||||
- name: Set up some cronjobs to backup databases as configured
|
||||
template: >
|
||||
src=cron-backup-database
|
||||
dest=/etc/cron.d/cron-backup-database-{{ item }}
|
||||
with_items:
|
||||
- "{{ dbs_to_backup }}"
|
||||
when: dbs_to_backup != []
|
||||
tags:
|
||||
- cron
|
||||
|
|
1
roles/postgresql_server/templates/cron-backup-database
Normal file
1
roles/postgresql_server/templates/cron-backup-database
Normal file
|
@ -0,0 +1 @@
|
|||
0 0 * * * postgres /usr/bin/pg_dump -C {{ item }} | /usr/bin/xz > /backups/{{ item }}-$(date +%F).dump.xz
|
Loading…
Add table
Add a link
Reference in a new issue