fix restore

This commit is contained in:
ace 2023-07-31 23:44:44 +03:00
parent 559cbfead1
commit 75662652c7
Signed by: ace
GPG Key ID: 2C08973DD37A76FD
2 changed files with 8 additions and 3 deletions

View File

@ -22,6 +22,10 @@ postgresql_wal_g_restore_config_name: ".walg-restore.json"
postgresql_wal_g_pitr: 'latest'
postgresql_wal_g_restore_backup_name: 'LATEST'
postgresql_wal_g_binary_name: "wal-g-pg"
#postgresql_postgresql_archive_command: "wal-g wal-push %p"
#postgresql_postgresql_restore_command: "wal-g wal-fetch %f %p"
#postgresql_restore_dbs_from_backup_command: "wal-g backup-fetch {{ postgresql_wal_g_restore_backup_name }}"
#postgresql_restore_wals_from_backup_command: "wal-g wal-fetch %f %p"
postgresql_recovery_target_time: ""
postgresql_promote_trigger_file: "{{ postgresql_data_dir }}/promote.trigger"
@ -68,6 +72,7 @@ postgresql_restore_parameters:
postgresql_log_dir: "/var/log/postgresql"
postgresql_supported_versions:
- 13
- 14

View File

@ -19,7 +19,7 @@
state: directory
become_user: postgres
- name: Check if d folder is empty before proceeding
- name: Check if database folder is empty before proceeding
find:
paths: "{{ postgresql_data_dir }}"
register: postgresql_files_found
@ -29,13 +29,13 @@
- postgresql_files_found.matched == 0
block:
- name: Restore database dir from backup
shell: "{{ postgresql_wal_g_binary_name ~ ' --config ' ~ postgresql_home_dir ~ '/' ~ postgresql_wal_g_restore_config_name ~ ' backup-fetch ' ~ postgresql_data_dir ~ ' ' ~ postgresql_wal_g_restore_backup_name }}"
shell: "{{ postgresql_restore_dbs_from_backup_command }}"
become_user: postgres
- name: Include PostgreSQL configuration
vars:
postgresql_archive_command: "cd ."
postgresql_restore_command: "{{ postgresql_wal_g_binary_name ~ ' --config ' ~ postgresql_home_dir ~ '/' ~ postgresql_wal_g_restore_config_name ~ ' wal-fetch %f %p' }}"
postgresql_restore_command: "{{ postgresql_restore_wals_from_backup_command }}"
include_tasks: config.yaml
- name: Create recovery.signal file