{% set users=salt['pillar.get']('data:config:pgusers', {}) %}
{% if 'components.pg-dbs.pgproxy' in salt['pillar.get']('data:runlist', []) %}
{% for user in users.keys() %}
{% if not users[user]['superuser'] and not users[user]['replication'] and users[user]['bouncer'] %}
{# Temporary putting * for port (MDB-899) #}
{# *:{{ users[user]['allow_port'] }}:{{ users[user]['allow_db'] }}:{{ user }}:{{ users[user]['password'] #}
*:*:{{ users[user]['allow_db'] }}:{{ user }}:{{ users[user]['password'] }}
{% endif %}
{% endfor %}
{% else %}
*:5432:*:repl:{{ users['repl']['password'] }}
{% endif %}
{% for user, options in users.iteritems() %}
{% if 'pgpass' in options and options['pgpass'] %}
*:5432:*:{{ user }}:{{ options['password'] }}
{% endif %}
{% endfor %}
