File tree Expand file tree Collapse file tree 3 files changed +6
-3
lines changed Expand file tree Collapse file tree 3 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,9 @@ postgresql_backup_local_dir: >-
17
17
'/var/lib/postgresql' if ansible_os_family == 'Debian' else '~postgres') }}/backup
18
18
postgresql_create_backup_dir : true
19
19
20
+ # Controls whether the wal_archive directory is cleaned and whether postgresql_create_backup_dir can be used
21
+ postgresql_backup_dir_is_remote : " {{ postgresql_backup_dir[0] != '/' }}"
22
+
20
23
# Options used for the WAL archive command - do not change this unless you have read the PITR documentation and
21
24
# understand how this command must work.
22
25
postgresql_archive_wal_rsync_args : ' --ignore-existing -ptg --info=skip1'
@@ -36,7 +39,7 @@ postgresql_backup_command: >-
36
39
--rsync-backup-opts {{ postgresql_backup_rsync_backup_opts | regex_replace('^-', '\-') | quote }}
37
40
--keep {{ postgresql_backup_keep | quote }}
38
41
{{ '--pg-bin-dir ' ~ __postgresql_pgdg_bin_dir if ansible_os_family == 'RedHat' else '' }}
39
- --backup {{ (':' in postgresql_backup_dir) | ternary('', '--clean-archive') }} {{ postgresql_backup_dir | quote }}
42
+ --backup {{ postgresql_backup_dir_is_remote | ternary('', '--clean-archive') }} {{ postgresql_backup_dir | quote }}
40
43
41
44
postgresql_backup_python_executable : " python"
42
45
Original file line number Diff line number Diff line change 18
18
mode : 0750
19
19
state : directory
20
20
path : " {{ postgresql_backup_dir }}"
21
- when : postgresql_backup_dir[0] == '/' and postgresql_create_backup_dir
21
+ when : not postgresql_backup_dir_is_remote and postgresql_create_backup_dir
22
22
23
23
- name : Install backup script templates
24
24
template :
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ wal_archive_dir={{ (postgresql_backup_dir ~ '/wal_archive') | quote }}
13
13
file_path=" $1 "
14
14
file_name=" $2 "
15
15
16
- {% if " : " in postgresql_backup_dir %}
16
+ {% if postgresql_backup_dir_is_remote %}
17
17
empty=$( mktemp -d -t ansible-postgresql-empty.XXXXXX)
18
18
rsync {{ postgresql_backup_rsync_connect_opts }} " ${empty} /" " $wal_archive_dir "
19
19
rmdir " $empty "
You can’t perform that action at this time.
0 commit comments