Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions automation/roles/patroni/tasks/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
---
# Patroni configure

# Ensure archive_command is set correctly for pgbackrest (same logic as pre_checks/pgbackrest.yml)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't quite understand why we should duplicate the logic here, because we are already set archive_command in pre_checks role.

- name: "pgBackRest | Ensure 'archive_command' is set to '{{ pgbackrest_archive_command | default('') }}'"
ansible.builtin.set_fact:
postgresql_parameters: >-
{{ postgresql_parameters | rejectattr('option', 'equalto', 'archive_command') | list
+ [{'option': 'archive_command', 'value': pgbackrest_archive_command}] }}
vars:
archive_command_item: "{{ postgresql_parameters | selectattr('option', 'equalto', 'archive_command') | list | last }}"
when:
- pgbackrest_install is defined
- pgbackrest_install | bool
- archive_command_item is undefined or archive_command_item.value != pgbackrest_archive_command
tags: patroni, patroni_conf

# Ensure archive_command is set correctly for wal-g (same logic as pre_checks/wal_g.yml)
- name: "WAL-G | Ensure 'archive_command' is set to '{{ wal_g_archive_command | default('') }}'"
ansible.builtin.set_fact:
postgresql_parameters: >-
{{ postgresql_parameters | rejectattr('option', 'equalto', 'archive_command') | list
+ [{'option': 'archive_command', 'value': wal_g_archive_command}] }}
vars:
archive_command_item: "{{ postgresql_parameters | selectattr('option', 'equalto', 'archive_command') | list | last }}"
when:
- wal_g_install is defined
- wal_g_install | bool
- archive_command_item is undefined or archive_command_item.value != wal_g_archive_command
tags: patroni, patroni_conf

- name: Make sure that conf directory exists
ansible.builtin.file:
path: /etc/patroni
Expand Down
Loading