2023-02-07 23:13:12 +00:00
|
|
|
---
|
2023-03-15 09:26:09 +00:00
|
|
|
- name: Create data directory
|
|
|
|
file:
|
|
|
|
path: "{{ postgresql_data_dir }}"
|
|
|
|
owner: "postgres"
|
|
|
|
group: "postgres"
|
|
|
|
state: directory
|
|
|
|
|
2023-03-29 20:47:01 +00:00
|
|
|
- name: Create configuration directory
|
|
|
|
file:
|
|
|
|
path: "{{ postgresql_config_dir }}/{{ postgresql_major_version }}/{{ postgresql_cluster_name }}"
|
|
|
|
owner: "postgres"
|
|
|
|
group: "postgres"
|
|
|
|
state: directory
|
|
|
|
|
2023-02-07 23:13:12 +00:00
|
|
|
- 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:
|
2023-07-21 14:14:47 +00:00
|
|
|
postgresql_combined_parameters: "{{ postgresql_combined_parameters | combine(postgresql_backup_parameters, recursive=true) }}"
|
|
|
|
|
|
|
|
- name: Merge restore options for PostgreSQL config
|
|
|
|
set_fact:
|
|
|
|
postgresql_combined_parameters: "{{ postgresql_combined_parameters | combine(postgresql_restore_parameters, recursive=true) }}"
|
2023-02-07 23:13:12 +00:00
|
|
|
|
|
|
|
- name: Propagate PostgreSQL configs
|
|
|
|
block:
|
|
|
|
- name: Template PostgreSQL pg_hba configuration
|
|
|
|
template:
|
|
|
|
src: "{{ postgresql_major_version }}-pg_hba.conf.j2"
|
2023-02-09 21:49:13 +00:00
|
|
|
dest: "{{ postgresql_config_dir }}/{{ postgresql_major_version }}/{{ postgresql_cluster_name }}/pg_hba.conf"
|
2023-02-07 23:13:12 +00:00
|
|
|
mode: 0600
|
|
|
|
owner: postgres
|
|
|
|
group: postgres
|
|
|
|
register: pg_hba_config_file
|
|
|
|
notify: Restart PostgreSQL
|
|
|
|
- name: Template PostgreSQL configuration
|
|
|
|
template:
|
|
|
|
src: "{{ postgresql_major_version }}-postgresql.conf.j2"
|
2023-02-09 21:49:13 +00:00
|
|
|
dest: "{{ postgresql_config_dir }}/{{ postgresql_major_version }}/{{ postgresql_cluster_name }}/postgresql.conf"
|
2023-02-07 23:13:12 +00:00
|
|
|
mode: 0600
|
|
|
|
owner: postgres
|
|
|
|
group: postgres
|
|
|
|
register: postgresql_config_file
|
|
|
|
notify: Restart PostgreSQL
|
|
|
|
- name: Template PostgreSQL SSL configuration
|
|
|
|
template:
|
|
|
|
src: "{{ postgresql_major_version }}-postgresql.ssl.conf.j2"
|
2023-02-09 21:49:13 +00:00
|
|
|
dest: "{{ postgresql_config_dir }}/{{ postgresql_major_version }}/{{ postgresql_cluster_name }}/postgresql.ssl.conf"
|
2023-02-07 23:13:12 +00:00
|
|
|
mode: 0600
|
|
|
|
owner: postgres
|
|
|
|
group: postgres
|
|
|
|
register: postgresql_ssl_config_file
|
|
|
|
notify: Restart PostgreSQL
|
|
|
|
when: postgresql_ssl
|