diff --git a/CHANGELOG.md b/CHANGELOG.md index 788c871f..0887de1e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ The **patch** part changes is incremented if multiple releases happen the same m * elasticsearch: improve networking configuration * evolinux-users: remove Stretch references in tasks that also apply to next Debian versions * mysql: improve shell syntax for mysql_skip script +* pbbouncer: minor fixes ### Fixed diff --git a/pgbouncer/README.md b/pgbouncer/README.md index fe8c0493..94cdeccf 100644 --- a/pgbouncer/README.md +++ b/pgbouncer/README.md @@ -32,9 +32,13 @@ pgbouncer_account_list: - { name: "account2", hash: "" } ``` -The value of `hash` can be obtained by running this command on the PostgreSQL server: `select passwd from pg_shadow where usename='account1';` +The value of `hash` can be obtained by running this command on the PostgreSQL server: -> These accounts must exist on the PostegreSQL server. +``` +select passwd from pg_shadow where usename='account1'; +``` + +> These accounts must exist on the PostgreSQL server. The variables `pgbouncer_admin_users` and `pgbouncer_stats_users` list the SQL user can be access on pgbouncer console. This variables can be defines like this : diff --git a/pgbouncer/defaults/main.yml b/pgbouncer/defaults/main.yml index 5b5d293f..211e6a5d 100644 --- a/pgbouncer/defaults/main.yml +++ b/pgbouncer/defaults/main.yml @@ -1,13 +1,18 @@ --- -pgbouncer_listen_addr: "127.0.0.1" +pgbouncer_listen_addr: + - "127.0.0.1" pgbouncer_listen_port: "6432" +# For PostgreSQL version < 14, use "md5" +# For PostgreSQL version >= 14, use "scram-sha-256" pgbouncer_auth_type: "scram-sha-256" +# Each entry must have "name", "host" and "port" keys pgbouncer_databases: [] pgbouncer_admin_users: [] pgbouncer_stats_users: [] +# Each entry must have "name" and "hash" keys pgbouncer_account_list: [] \ No newline at end of file diff --git a/pgbouncer/tasks/main.yml b/pgbouncer/tasks/main.yml index f52383a2..0463899d 100644 --- a/pgbouncer/tasks/main.yml +++ b/pgbouncer/tasks/main.yml @@ -7,17 +7,18 @@ - name: Limit for PgBouncer is set ansible.builtin.lineinfile: path: /etc/default/pgbouncer + regexp: "ulimit -n" line: ulimit -n 65536 - notify: Restart PgBouncer + notify: restart pgbouncer - name: Add config file for PgBouncer ansible.builtin.template: src: pgbouncer.ini.j2 dest: /etc/pgbouncer/pgbouncer.ini - notify: Restart PgBouncer + notify: restart pgbouncer - name: Populate userlist.txt ansible.builtin.template: src: userlist.txt.j2 dest: /etc/pgbouncer/userlist.txt - notify: Restart PgBouncer + notify: restart pgbouncer diff --git a/pgbouncer/templates/pgbouncer.ini.j2 b/pgbouncer/templates/pgbouncer.ini.j2 index 11eac58c..b2d89e47 100644 --- a/pgbouncer/templates/pgbouncer.ini.j2 +++ b/pgbouncer/templates/pgbouncer.ini.j2 @@ -7,7 +7,7 @@ logfile = /var/log/postgresql/pgbouncer.log pidfile = /var/run/postgresql/pgbouncer.pid -listen_addr = {{ pgbouncer_listen_addr }} +listen_addr = {{ pgbouncer_listen_addr | join(',') }} listen_port = {{ pgbouncer_listen_port }} unix_socket_dir =