Skip to content

Commit

Permalink
Update pgbackrest.conf.j2
Browse files Browse the repository at this point in the history
  • Loading branch information
vitabaks committed Jan 4, 2024
1 parent 25e38a0 commit 63112bf
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions roles/pgbackrest/templates/pgbackrest.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}

0 comments on commit 63112bf

Please sign in to comment.