diff --git a/roles/pgbouncer/templates/pgbouncer.ini.j2 b/roles/pgbouncer/templates/pgbouncer.ini.j2 index 23c7a1e20..661214ae3 100644 --- a/roles/pgbouncer/templates/pgbouncer.ini.j2 +++ b/roles/pgbouncer/templates/pgbouncer.ini.j2 @@ -1,9 +1,9 @@ [databases] {% for pool in pgbouncer_pools %} -{{ pool.name }} = host=127.0.0.1 port={{ postgresql_port }} dbname={{ pool.dbname }} {{ pool.pool_parameters }} +{{ pool.name }} = host={{ postgresql_unix_socket_dir }} port={{ postgresql_port }} dbname={{ pool.dbname }} {{ pool.pool_parameters }} {% endfor %} -* = host=127.0.0.1 port={{ postgresql_port }} +* = host={{ postgresql_unix_socket_dir }} port={{ postgresql_port }} [pgbouncer] logfile = {{ pgbouncer_log_dir }}/pgbouncer{{ '-%d' % (idx + 1) if idx > 0 else '' }}.log diff --git a/vars/main.yml b/vars/main.yml index 27102e65d..0750a62d8 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -273,9 +273,9 @@ pending_restart: false # specify additional hosts that will be added to the pg_hba.conf postgresql_pg_hba: - { type: "local", database: "all", user: "{{ patroni_superuser_username }}", address: "", method: "trust" } + - { type: "local", database: "all", user: "{{ pgbouncer_auth_username }}", address: "", method: "trust" } # required for pgbouncer auth_user - { type: "local", database: "replication", user: "{{ patroni_superuser_username }}", address: "", method: "trust" } - { type: "local", database: "all", user: "all", address: "", method: "peer" } - - { type: "host", database: "all", user: "{{ pgbouncer_auth_username }}", address: "127.0.0.1/32", method: "trust" } # required for pgbouncer auth_user - { type: "host", database: "all", user: "all", address: "127.0.0.1/32", method: "{{ postgresql_password_encryption_algorithm }}" } - { type: "host", database: "all", user: "all", address: "::1/128", method: "{{ postgresql_password_encryption_algorithm }}" } # - { type: "host", database: "mydatabase", user: "mydb-user", address: "192.168.0.0/24", method: "{{ postgresql_password_encryption_algorithm }}" }