Skip to content

Commit

Permalink
pgbouncer: Add auth_dbname option (#433)
Browse files Browse the repository at this point in the history
  • Loading branch information
vitabaks authored Aug 3, 2023
1 parent 4c19711 commit fa84970
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions roles/pgbouncer/templates/pgbouncer.ini.j2
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ unix_socket_dir = /var/run/postgresql
auth_type = {{ pgbouncer_auth_type }}
{% if pgbouncer_auth_user | bool %}
auth_user = {{ pgbouncer_auth_username }}
auth_dbname = {{ pgbouncer_auth_dbname }}
auth_query = SELECT usename, passwd FROM user_search($1)
{% else %}
auth_file = {{ pgbouncer_conf_dir }}/userlist.txt
Expand Down
5 changes: 3 additions & 2 deletions vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -295,13 +295,14 @@ pgbouncer_max_db_connections: 1000
pgbouncer_default_pool_size: 20
pgbouncer_query_wait_timeout: 120
pgbouncer_default_pool_mode: "session"
pgbouncer_admin_users: "postgres" # comma-separated list of users, who are allowed to change settings
pgbouncer_stats_users: "postgres" # comma-separated list of users who are just allowed to use SHOW command
pgbouncer_admin_users: "{{ patroni_superuser_username }}" # comma-separated list of users, who are allowed to change settings
pgbouncer_stats_users: "{{ patroni_superuser_username }}" # comma-separated list of users who are just allowed to use SHOW command
pgbouncer_ignore_startup_parameters: "extra_float_digits,geqo,search_path"
pgbouncer_auth_type: "{{ postgresql_password_encryption_algorithm }}"
pgbouncer_auth_user: true # or 'false' if you want to manage the list of users for authentication in the database via userlist.txt
pgbouncer_auth_username: pgbouncer # user who can query the database via the user_search function
pgbouncer_auth_password: "pgbouncer-pass" # please change password
pgbouncer_auth_dbname: "postgres"

pgbouncer_pools:
- { name: "postgres", dbname: "postgres", pool_parameters: "" }
Expand Down

0 comments on commit fa84970

Please sign in to comment.