-
-
Notifications
You must be signed in to change notification settings - Fork 442
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the ability to configure a dedicated pgBackRest server (#379)
This commit introduces significant improvements to our backup and recovery capabilities with pgBackRest. The main feature is the ability to configure and manage the dedicated pgBackRest servers (pgbackrest_server_conf variable). Previously, backup configuration was limited to the database servers only. In addition to these improvements, add pgBackRest cron jobs via the "pgbackrest_cron_jobs" variable. Backup Jobs will be automatically configured. By default, the cron jobs is created on the database server. If 'pgbackrest_repo_host' is defined, the cron jobs will be created on the dedicated pgBackRest server. Updated the pgBackRest configuration template to enable configuration of a single dedicated pgBackRest server for multiple Postgres clusters.
- Loading branch information
Showing
10 changed files
with
226 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
|
||
- name: Add pgbackrest cron jobs on database server | ||
cron: | ||
cron_file: "{{ item.file | default('') }}" | ||
user: "{{ item.user | default('postgres') }}" | ||
minute: "{{ item.minute | default('*') }}" | ||
hour: "{{ item.hour | default('*') }}" | ||
day: "{{ item.day | default('*') }}" | ||
month: "{{ item.month | default('*') }}" | ||
weekday: "{{ item.weekday | default('*') }}" | ||
name: "{{ item.name }}" | ||
disabled: "{{ item.disabled | default(False) }}" | ||
state: "{{ item.state | default('present') }}" | ||
job: "{{ item.job }}" | ||
loop: "{{ pgbackrest_cron_jobs }}" | ||
when: | ||
- "'postgres_cluster' in group_names" | ||
- pgbackrest_repo_host | default('') | length < 1 | ||
|
||
# Dedicated pgbackrest server (if "repo_host" is set) | ||
- name: Add pgbackrest cron jobs on pgbackrest server | ||
cron: | ||
cron_file: "{{ item.file | default('') }}" | ||
user: "{{ item.user | default('postgres') }}" | ||
minute: "{{ item.minute | default('*') }}" | ||
hour: "{{ item.hour | default('*') }}" | ||
day: "{{ item.day | default('*') }}" | ||
month: "{{ item.month | default('*') }}" | ||
weekday: "{{ item.weekday | default('*') }}" | ||
name: "{{ item.name }}" | ||
disabled: "{{ item.disabled | default(False) }}" | ||
state: "{{ item.state | default('present') }}" | ||
job: "{{ item.job }}" | ||
loop: "{{ pgbackrest_cron_jobs }}" | ||
when: | ||
- "'pgbackrest' in group_names" | ||
- pgbackrest_repo_host | default('') | length > 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[global] | ||
{% for global in pgbackrest_server_conf.global %} | ||
{{ global.option }}={{ global.value }} | ||
{% endfor %} | ||
|
||
# Include stanzas configuration files | ||
include-path = {{ pgbackrest_conf_file | dirname }}/conf.d | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[{{ pgbackrest_stanza }}] | ||
{% for host in groups['postgres_cluster'] %} | ||
pg{{ loop.index }}-host={{ host }} | ||
pg{{ loop.index }}-port={{ postgresql_port }} | ||
pg{{ loop.index }}-path={{ postgresql_data_dir }} | ||
{% endfor %} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters