infra-role-postgres-ha/tasks/hba.yml

23 lines
699 B
YAML
Raw Permalink Normal View History

---
- name: 'Wait for the DB to be available'
wait_for:
port: '{{ postgres_ha_cont_port }}'
delay: 5
- name: 'Allow VPN connections in HBA config'
register: postgres_ha_hba
blockinfile:
path: '{{ postgres_ha_cont_data_vol }}/pgdata/pg_hba.conf'
marker: '# {mark} ANSIBLE MANAGED REPLICATORS'
block: |
{% for addr in postgres_ha_replica_allowed_addresses %}
host replication replicator {{ addr }} md5
{% endfor %}
- name: 'Restart database container'
when: postgres_ha_hba.changed
2024-05-30 14:29:14 +00:00
community.docker.docker_compose_v2:
project_src: '{{ postgres_ha_service_path }}'
files: '{{ postgres_ha_compose_file }}'
2024-05-30 14:29:14 +00:00
state: restarted