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: >-
1717 '/var/lib/postgresql' if ansible_os_family == 'Debian' else '~postgres') }}/backup
1818postgresql_create_backup_dir : true
1919
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+
2023# Options used for the WAL archive command - do not change this unless you have read the PITR documentation and
2124# understand how this command must work.
2225postgresql_archive_wal_rsync_args : ' --ignore-existing -ptg --info=skip1'
@@ -36,7 +39,7 @@ postgresql_backup_command: >-
3639 --rsync-backup-opts {{ postgresql_backup_rsync_backup_opts | regex_replace('^-', '\-') | quote }}
3740 --keep {{ postgresql_backup_keep | quote }}
3841 {{ '--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 }}
4043
4144postgresql_backup_python_executable : " python"
4245
Original file line number Diff line number Diff line change 1818 mode : 0750
1919 state : directory
2020 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
2222
2323- name : Install backup script templates
2424 template :
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ wal_archive_dir={{ (postgresql_backup_dir ~ '/wal_archive') | quote }}
1313file_path=" $1 "
1414file_name=" $2 "
1515
16- {% if " : " in postgresql_backup_dir %}
16+ {% if postgresql_backup_dir_is_remote %}
1717empty=$( mktemp -d -t ansible-postgresql-empty.XXXXXX)
1818rsync {{ postgresql_backup_rsync_connect_opts }} " ${empty} /" " $wal_archive_dir "
1919rmdir " $empty "
You can’t perform that action at this time.
0 commit comments