Skip to content

[Feat] Support dual-stack IPv4 and IPv6 when configuring pg_hba.conf for replication hosts #1229

@bkhomuts

Description

@bkhomuts

Problem

At this moment pg_hba.conf is configured only with IPv4 address of each node. As a result, connections may fail, if replicas connect using the domain name (expected to be supported #1228).

Description

When autobase configures pg_hba.conf, it should also allow the IPv6 address of the hostname.

Importance

nice to have

Proposed implementation

Define bind_address_v6 for each host in inventory, and then update pg_hba.conf.j2 to look like

{% for host in groups['postgres_cluster'] %}
  hostssl      replication              {{ patroni_replication_username }}               {{ hostvars[host]['patroni_bind_address'] | default(hostvars[host]['bind_address'], true) }}/32         {{ postgresql_password_encryption_algorithm }}
  {% if hostvars[host]['bind_address_v6'] %}
  hostssl      replication              {{ patroni_replication_username }}               {{ hostvars[host]['patroni_bind_address_v6'] | default(hostvars[host]['bind_address_v6'], true) }}/128  {{ postgresql_password_encryption_algorithm }}
  {% endif %}
{% endfor %}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions