mirror of
https://gitea.0xace.cc/ansible-galaxy/postgresql.git
synced 2024-11-25 00:06:42 +00:00
64 lines
2.3 KiB
YAML
64 lines
2.3 KiB
YAML
---
|
|
- name: Create data directory
|
|
file:
|
|
path: "{{ postgresql_data_dir }}"
|
|
owner: "{{ postgresql_user }}"
|
|
group: "{{ postgresql_group }}"
|
|
state: directory
|
|
|
|
- name: Create configuration directory
|
|
file:
|
|
path: "{{ postgresql_config_dir }}/{{ postgresql_major_version }}/{{ postgresql_cluster_name }}"
|
|
owner: "{{ postgresql_user }}"
|
|
group: "{{ postgresql_group }}"
|
|
state: directory
|
|
|
|
- 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, recursive=true) }}"
|
|
|
|
- name: Merge restore options for PostgreSQL config
|
|
set_fact:
|
|
postgresql_combined_parameters: "{{ postgresql_combined_parameters | combine(postgresql_restore_parameters, recursive=true) }}"
|
|
|
|
- name: Propagate PostgreSQL configs
|
|
block:
|
|
- name: Template PostgreSQL pg_hba configuration
|
|
template:
|
|
src: "pg_hba.conf.j2"
|
|
dest: "{{ postgresql_config_dir }}/{{ postgresql_major_version }}/{{ postgresql_cluster_name }}/pg_hba.conf"
|
|
mode: 0600
|
|
owner: "{{ postgresql_user }}"
|
|
group: "{{ postgresql_group }}"
|
|
register: pg_hba_config_file
|
|
notify:
|
|
- Reload PostgreSQL
|
|
- Restart PostgreSQL
|
|
- name: Template PostgreSQL configuration
|
|
template:
|
|
src: "postgresql.conf.j2"
|
|
dest: "{{ postgresql_config_dir }}/{{ postgresql_major_version }}/{{ postgresql_cluster_name }}/postgresql.conf"
|
|
mode: 0600
|
|
owner: "{{ postgresql_user }}"
|
|
group: "{{ postgresql_group }}"
|
|
register: postgresql_config_file
|
|
notify:
|
|
- Reload PostgreSQL
|
|
- Restart PostgreSQL
|
|
- name: Template PostgreSQL SSL configuration
|
|
template:
|
|
src: "postgresql.ssl.conf.j2"
|
|
dest: "{{ postgresql_config_dir }}/{{ postgresql_major_version }}/{{ postgresql_cluster_name }}/postgresql.ssl.conf"
|
|
mode: 0600
|
|
owner: "{{ postgresql_user }}"
|
|
group: "{{ postgresql_group }}"
|
|
register: postgresql_ssl_config_file
|
|
notify:
|
|
- Reload PostgreSQL
|
|
- Restart PostgreSQL
|
|
when: postgresql_ssl
|