-
Notifications
You must be signed in to change notification settings - Fork 58
Backup strategy using pg-dump #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
9425bbe
70bb3dc
40dffe4
ee8d2f7
ffaa8d7
c580055
aaa3bf8
89ecfc3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,6 +1,9 @@ | ||||||||||||||
--- | ||||||||||||||
|
||||||||||||||
postgresql_default_version: 10 | ||||||||||||||
postgresql_default_version: 13 | ||||||||||||||
postgresql_backup_active_dir: "{{ postgresql_backup_local_dir }}/active" | ||||||||||||||
postgresql_backup_mail_recipient: postgres | ||||||||||||||
postgresql_backup_rotate: true | ||||||||||||||
postgresql_user_name: postgres | ||||||||||||||
|
||||||||||||||
# Point-In-Time Recovery (PITR) backup options | ||||||||||||||
|
@@ -30,3 +33,7 @@ postgresql_backup_command: >- | |||||||||||||
--keep {{ postgresql_backup_keep | quote }} | ||||||||||||||
{{ '--pg-bin-dir ' ~ __postgresql_pgdg_bin_dir if ansible_os_family == 'RedHat' else '' }} | ||||||||||||||
--backup --clean-archive {{ postgresql_backup_dir | quote }} | ||||||||||||||
|
||||||||||||||
postgresql_pgdump_cronspec: "00 18 * * 1-7" | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
postgresql_pgdump_filespec: 'full.daily.`/bin/date +"\%u"`.sql' | ||||||||||||||
|
||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I think this needs to be documented somewhere, maybe in the readme? |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,18 @@ | ||||||||||||||||||||||||||||||||||||
--- | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
- name: Create backup directory for pgdump | ||||||||||||||||||||||||||||||||||||
file: | ||||||||||||||||||||||||||||||||||||
owner: postgres | ||||||||||||||||||||||||||||||||||||
group: postgres | ||||||||||||||||||||||||||||||||||||
mode: 0750 | ||||||||||||||||||||||||||||||||||||
state: directory | ||||||||||||||||||||||||||||||||||||
path: "{{ postgresql_pgdump_dir }}" | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
- name: Schedule pgdump backups via cron(8) | ||||||||||||||||||||||||||||||||||||
template: | ||||||||||||||||||||||||||||||||||||
src: local-pgdump.crontab | ||||||||||||||||||||||||||||||||||||
dest: /etc/cron.d/local-pgdump | ||||||||||||||||||||||||||||||||||||
owner: root | ||||||||||||||||||||||||||||||||||||
group: root | ||||||||||||||||||||||||||||||||||||
mode: 0644 | ||||||||||||||||||||||||||||||||||||
Comment on lines
+12
to
+17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should do this via the cron module to be a bit more standard
Suggested change
|
||||||||||||||||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{{ postgresql_pgdump_cronspec }} {{ postgresql_user_name }} {{ postgresql_inst_dir_default }}/bin/pg_dumpall -c -f {{ postgresql_pgdump_dir }}/{{ postgresql_pgdump_filespec }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. now unnecessary |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@natefoo any issue with this?