[databases] {% for pool in pgbouncer_pools %} {{ pool.name }} = host={{ pool.host | default('127.0.0.1') }} port={{ pool.port | default('5432') }} dbname={{ pool.dbname }} {{ pool.pool_parameters }} {% endfor %} * = host=127.0.0.1 port={{ pgbouncer_postgresql_port | default('5432') }} [pgbouncer] {% if pgbouncer_client_tls_sslmode != 'disable' %} client_tls_sslmode = {{ pgbouncer_client_tls_sslmode }} client_tls_protocols = {{ pgbouncer_client_tls_protocols }} client_tls_ciphers = {{ pgbouncer_client_tls_ciphers }} client_tls_key_file = {{ pgbouncer_client_tls_key_file }} client_tls_cert_file = {{ pgbouncer_client_tls_cert_file }} {% endif %} {% if pgbouncer_server_tls_sslmode != 'disable' %} server_tls_sslmode = {{ pgbouncer_server_tls_sslmode }} {% endif %} logfile = {{ pgbouncer_log_dir }}/{{ pgbouncer_log_name }} pidfile = {{ pgbouncer_pid_dir }}/{{ pgbouncer_pid_name }} listen_addr = {{ hostvars[inventory_hostname]['inventory_hostname'] }} listen_port = {{ pgbouncer_listen_port | default(6432) }} unix_socket_dir = /var/run/postgresql auth_type = {{ pgbouncer_auth_type }} auth_file = {{ pgbouncer_auth_file }} {% if pgbouncer_auth_user is defined %} auth_user = {{ pgbouncer_auth_user }} {% endif %} {% if pgbouncer_auth_type == 'hba' %} auth_hba_file = {{ pgbouncer_auth_hba_file }} {% endif %} admin_users = {{ pgbouncer_admin_users }} ignore_startup_parameters = {{ pgbouncer_ignore_startup_parameters }} pool_mode = {{ pgbouncer_default_pool_mode }} server_reset_query = DISCARD ALL max_client_conn = {{ pgbouncer_max_client_conn }} default_pool_size = {{ pgbouncer_default_pool_size }} reserve_pool_size = 1 reserve_pool_timeout = 1 max_db_connections = {{ pgbouncer_max_db_connections }} pkt_buf = 8192 listen_backlog = 4096 log_connections = 0 log_disconnections = 0 # Documentation https://pgbouncer.github.io/config.html