{
    "Servers": {
        {% set pg_servers = stage_server_infos | selectattr('service', 'equalto', 'postgres') | selectattr('role', 'equalto', 'master') | list %}
        {% for server in pg_servers %}
        "{{ loop.index }}": {
            "Name": "{{ server.name }}",
            "Group": "Servers_Readonly",
            "Host": "{{ server.name }}",
            "HostAddr": "{{ server.private_ip }}",
            "Port": 5432,
            "MaintenanceDB": "{{ postgres_admin_user }}",
            "Username": "{{ pgadmin4_oidc_dev_username }}",
            "PassFile": "/pgpass",
            "SSLMode": "prefer"
        }{% if not loop.last and pg_servers|length > 1 %},
        {% endif %}
        {% endfor %}
    }
}
