use postgresql_home_dir

This commit is contained in:
ace 2023-02-21 16:14:02 +03:00
parent 98b48a3566
commit 9207b91282
Signed by: ace
GPG Key ID: 2C08973DD37A76FD
7 changed files with 15 additions and 13 deletions

View File

@ -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"

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -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"

View File

@ -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"

View File

@ -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"