diff --git a/defaults/main.yaml b/defaults/main.yaml index 0372373..8b0cddf 100644 --- a/defaults/main.yaml +++ b/defaults/main.yaml @@ -20,6 +20,7 @@ postgresql_wal_g_config_name: ".walg.json" postgresql_wal_g_restore_config_name: ".walg-restore.json" postgresql_wal_g_binary_name: "wal-g-pg" postgresql_wal_g_postgresql_pitr: "LATEST" +postgresql_recovery_target_time: "" postgresql_promote_trigger_file: "{{ postgresql_data_dir }}/promote.trigger" postgresql_password_encryption_algorithm: "scram-sha-256" @@ -54,12 +55,13 @@ postgresql_default_parameters: lc_time: '{{ postgresql_system_locale | default("en_US.UTF-8") }}' default_text_search_config: 'pg_catalog.english' password_encryption: '{{ postgresql_password_encryption_algorithm }}' + hot_standby: 'off' promote_trigger_file: '{{ postgresql_promote_trigger_file }}' postgresql_backup_parameters: archive_command: "{{ postgresql_archive_command | default('cd .')}}" restore_command: "{{ postgresql_restore_command | default('cd .') }}" - archive_mode: on + archive_mode: "{{ postgresql_archive_mode | default('on') }}" postgresql_log_dir: "/var/log/postgresql" diff --git a/tasks/RedHat/main.yaml b/tasks/RedHat/main.yaml index 257e907..4ca73a9 100644 --- a/tasks/RedHat/main.yaml +++ b/tasks/RedHat/main.yaml @@ -31,7 +31,7 @@ name: wal-g vars: wal_g_pg: yes - wal_g_pg_home_dir: "{{ postgresql_base_dir }}" + wal_g_pg_home_dir: "{{ postgresql_home_dir }}" wal_g_pg_data_dir: "{{ postgresql_data_dir }}" wal_g_restore: "{{ postgresql_wal_g_restore }}" when: postgresql_wal_g_install diff --git a/tasks/main.yaml b/tasks/main.yaml index 538cff4..e1ce9d1 100644 --- a/tasks/main.yaml +++ b/tasks/main.yaml @@ -14,7 +14,7 @@ - name: Set facts about needed vars set_fact: - postgresql_base_dir: "{{ postgresql_base_dir }}" + postgresql_home_dir: "{{ postgresql_home_dir }}" postgresql_data_dir: "{{ postgresql_data_dir }}" - name: "Set locale for PostgreSQL" diff --git a/tasks/restore.yaml b/tasks/restore.yaml index 545ce37..0a83ada 100644 --- a/tasks/restore.yaml +++ b/tasks/restore.yaml @@ -29,12 +29,12 @@ - postgresql_files_found.matched == 0 block: - name: Restore database dir from backup - shell: "{{ postgresql_wal_g_binary_name ~ ' --config ' ~ postgresql_base_dir ~ '/' ~ postgresql_wal_g_restore_config_name ~ ' backup-fetch ' ~ postgresql_data_dir ~ ' ' ~ postgresql_wal_g_postgresql_pitr }}" + shell: "{{ postgresql_wal_g_binary_name ~ ' --config ' ~ postgresql_home_dir ~ '/' ~ postgresql_wal_g_restore_config_name ~ ' backup-fetch ' ~ postgresql_data_dir ~ ' ' ~ postgresql_wal_g_postgresql_pitr }}" become_user: postgres - name: Include PostgreSQL configuration vars: - postgresql_restore_command: "{{ postgresql_wal_g_binary_name ~ ' --config ' ~ postgresql_base_dir ~ '/' ~ postgresql_wal_g_restore_config_name ~ ' wal-fetch %f %p' }}" + postgresql_restore_command: "{{ postgresql_wal_g_binary_name ~ ' --config ' ~ postgresql_home_dir ~ '/' ~ postgresql_wal_g_restore_config_name ~ ' wal-fetch %f %p' }}" include_tasks: config.yaml - name: Create recovery.signal file diff --git a/vars/Debian-11.yaml b/vars/Debian-11.yaml index 0f4148d..e14edac 100644 --- a/vars/Debian-11.yaml +++ b/vars/Debian-11.yaml @@ -14,8 +14,8 @@ postgresql_package_name: "postgresql-{{ postgresql_major_version }}" postgresql_package: "{{ postgresql_package_name }}={{ postgresql_version }}-{{ postgresql_version_build }}" postgresql_version_build: "1.pgdg110+1" postgresql_config_dir: "/etc/postgresql" -postgresql_base_dir: "/var/lib/postgresql" -postgresql_data_dir: "{{ postgresql_base_dir }}/{{ postgresql_major_version }}/{{ postgresql_cluster_name }}" +postgresql_home_dir: "/var/lib/postgresql" +postgresql_data_dir: "{{ postgresql_home_dir }}/{{ postgresql_major_version }}/{{ postgresql_cluster_name }}" postgresql_ssl_path: "{{ postgresql_config_dir }}/{{ postgresql_major_version }}/{{ postgresql_cluster_name }}" postgresql_package_name_regex: "{{ postgresql_package_name }}-{{ postgresql_version }}-{{ postgresql_version_build }}" postgresql_cluster_name: "main" diff --git a/vars/RedHat-8.yaml b/vars/RedHat-8.yaml index 3956526..906d055 100644 --- a/vars/RedHat-8.yaml +++ b/vars/RedHat-8.yaml @@ -2,9 +2,9 @@ postgresql_repo_package: "https://download.postgresql.org/pub/repos/yum/reporpms postgresql_package_name: "postgresql" postgresql_package: "{{ postgresql_package_name }}{{ postgresql_major_version }}-server-{{ postgresql_version }}" -postgresql_base_dir: "/var/lib/pgsql" -postgresql_data_dir: "{{ postgresql_base_dir }}/{{ postgresql_major_version }}/data" -postgresql_ssl_path: "{{ postgresql_base_dir }}/{{ postgresql_major_version }}" +postgresql_home_dir: "/var/lib/pgsql" +postgresql_data_dir: "{{ postgresql_home_dir }}/{{ postgresql_major_version }}/data" +postgresql_ssl_path: "{{ postgresql_home_dir }}/{{ postgresql_major_version }}" postgresql_ssl_update_ca_command: "update-ca-trust extract" postgresql_ssl_ca_trust_dir: "/etc/pki/ca-trust/source/anchors" diff --git a/vars/RedHat-9.yaml b/vars/RedHat-9.yaml index 545e66c..cc608da 100644 --- a/vars/RedHat-9.yaml +++ b/vars/RedHat-9.yaml @@ -2,9 +2,9 @@ postgresql_repo_package: "https://download.postgresql.org/pub/repos/yum/reporpms postgresql_package_name: "postgresql" postgresql_package: "{{ postgresql_package_name }}{{ postgresql_major_version }}-server-{{ postgresql_version }}" -postgresql_base_dir: "/var/lib/pgsql" -postgresql_data_dir: "{{ postgresql_base_dir }}/{{ postgresql_major_version }}/data" -postgresql_ssl_path: "{{ postgresql_base_dir }}/{{ postgresql_major_version }}" +postgresql_home_dir: "/var/lib/pgsql" +postgresql_data_dir: "{{ postgresql_home_dir }}/{{ postgresql_major_version }}/data" +postgresql_ssl_path: "{{ postgresql_home_dir }}/{{ postgresql_major_version }}" postgresql_ssl_update_ca_command: "update-ca-trust extract" postgresql_ssl_ca_trust_dir: "/etc/pki/ca-trust/source/anchors"