postgresql/tasks/RedHat/config.yaml

60 lines
2.1 KiB
YAML

---
- name: Merge user options for PostgreSQL config
set_fact:
postgresql_combined_parameters: "{{ postgresql_default_parameters | combine(postgresql_custom_parameters|default({}), recursive=true) }}"
- name: Merge backup options for PostgreSQL config
set_fact:
postgresql_combined_parameters: "{{ postgresql_combined_parameters | combine(postgresql_backup_parameters|default({}), recursive=true) }}"
- name: Merge restore options for PostgreSQL config
set_fact:
postgresql_combined_parameters: "{{ postgresql_combined_parameters | combine(postgresql_restore_parameters, recursive=true) }}"
- name: Merge PITR restore options for PostgreSQL config
set_fact:
postgresql_combined_parameters: "{{ postgresql_combined_parameters | combine(postgresql_restore_pitr_parameters, recursive=true) }}"
when:
- postgresql_wal_g_restore_from_backup
- postgresql_wal_g_pitr | length > 0
- name: Propagate PostgreSQL configs
block:
- name: Template PostgreSQL pg_hba configuration
template:
src: "pg_hba.conf.j2"
dest: "{{ postgresql_data_dir }}/pg_hba.conf"
mode: 0600
owner: "{{ postgresql_user }}"
group: "{{ postgresql_group }}"
backup: yes
register: pg_hba_config_file
notify:
- Reload PostgreSQL
- Restart PostgreSQL
- name: Template PostgreSQL configuration
template:
src: "postgresql.conf.j2"
dest: "{{ postgresql_data_dir }}/postgresql.conf"
mode: 0600
owner: "{{ postgresql_user }}"
group: "{{ postgresql_group }}"
backup: yes
register: postgresql_config_file
notify:
- Reload PostgreSQL
- Restart PostgreSQL
- name: Template PostgreSQL SSL configuration
template:
src: "postgresql.ssl.conf.j2"
dest: "{{ postgresql_data_dir }}/postgresql.ssl.conf"
mode: 0600
owner: "{{ postgresql_user }}"
group: "{{ postgresql_group }}"
backup: yes
register: postgresql_ssl_config_file
notify:
- Reload PostgreSQL
- Restart PostgreSQL
when: postgresql_ssl