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

23 lines
699 B
YAML

---
- 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
community.docker.docker_compose_v2:
project_src: '{{ postgres_ha_service_path }}'
files: '{{ postgres_ha_compose_file }}'
state: restarted