## {{ salt['pillar.get']('salt_managed', default='Salt Managed') }}
{%- from "postgresql/map.jinja" import net with context %}

{% for user in ['repmgr','replication'] %}
local   {{ user }}    repmgr                    trust
{%- for network in net.ip_networks %}
host    {{ user }}    repmgr    {{ network }}   trust
{%- endfor %}
{%- endfor %}

### Basic auth for users
{%- for network in net.ip_networks %}
host    all           all       {{ network }}   md5
{%- endfor %}
{%- for network in net.optional_ip_networks %}
host    all           all       {{ network }}   md5
{%- endfor %}


local   all           postgres                  peer

local   all           all                       peer
host    all           all       127.0.0.1/32    md5
host    all           all       ::1/128         md5

local   replication   all                       peer
host    replication   all       127.0.0.1/32    md5
host    replication   all       ::1/128         md5