From 63112bfc691f3499017667c6382aca6a089ebfc2 Mon Sep 17 00:00:00 2001 From: Vitaliy Kukharik Date: Thu, 4 Jan 2024 13:57:16 +0300 Subject: [PATCH] Update pgbackrest.conf.j2 --- roles/pgbackrest/templates/pgbackrest.conf.j2 | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/roles/pgbackrest/templates/pgbackrest.conf.j2 b/roles/pgbackrest/templates/pgbackrest.conf.j2 index 7f959efa4..db3b97565 100644 --- a/roles/pgbackrest/templates/pgbackrest.conf.j2 +++ b/roles/pgbackrest/templates/pgbackrest.conf.j2 @@ -8,13 +8,10 @@ {{ stanza.option }}={{ stanza.value }} {% endfor %} {% if pgbackrest_conf.global | selectattr('option', 'equalto', 'backup-standby') | map(attribute='value') | list | last | default('') == 'y' %} -{% set host_index = 2 %} -{% for host in groups['postgres_cluster'] %} -{% if host != inventory_hostname %} -pg{{ host_index }}-host={{ host }} -pg{{ host_index }}-port={{ postgresql_port }} -pg{{ host_index }}-path={{ postgresql_data_dir }} -{% set host_index = host_index + 1 %} -{% endif %} +{% set pg_standby_hosts = groups['postgres_cluster'] | reject('equalto', inventory_hostname) | list %} +{% for host in pg_standby_hosts %} +pg{{ loop.index + 1 }}-host={{ host }} +pg{{ loop.index + 1 }}-port={{ postgresql_port }} +pg{{ loop.index + 1 }}-path={{ postgresql_data_dir }} {% endfor %} {% endif %}