patroni/tasks/config.yaml
2023-05-13 01:19:23 +03:00

38 lines
1.1 KiB
YAML

---
- name: Merge user options for PostgreSQL part of Patroni config
set_fact:
patroni_postgresql_parameters_combined: "{{ patroni_postgresql_default_parameters | combine(patroni_postgresql_parameters|default({}), recursive=true) }}"
- name: Template Patroni default config
set_fact:
patroni_default_config: "{{ lookup('template', 'patroni.yaml.j2') | from_yaml }}"
- name: Print Patroni default config
debug:
msg: "{{ patroni_default_config }}"
verbosity: 2
- name: Merge user options with default Patroni config
set_fact:
patroni_config_combined: "{{ patroni_default_config | combine(patroni_config|default({}), recursive=true) }}"
- name: Create folder for Patroni config
file:
name: "{{ item }}"
state: directory
owner: "postgres"
group: "postgres"
loop:
- /etc/patroni
- /var/lib/pgsql_stats_tmp
- name: Propagate Patroni config
copy:
content: "{{ patroni_config_combined | to_nice_yaml }}"
dest: "/etc/patroni/{{ patroni_config_name }}"
owner: "postgres"
group: "postgres"
mode: 0644
register: patroni_config_file
notify: Restart Patroni