Skip to content

Commit 3c09886

Browse files
committed
fix: ensure pgbouncer works upon systemctl start
1 parent c12c7b0 commit 3c09886

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

ansible/files/pgbouncer_config/pgbouncer.ini.j2

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,9 @@ listen_port = 6543
5656

5757
;; Unix socket is also used for -R.
5858
;; On Debian it should be /var/run/postgresql
59-
;unix_socket_dir = /tmp
59+
unix_socket_dir = /tmp
6060
;unix_socket_mode = 0777
6161
;unix_socket_group =
62-
unix_socket_dir = /var/run/postgresql
6362

6463
;;;
6564
;;; TLS settings for accepting clients
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Directory for PostgreSQL sockets, lockfiles and stats tempfiles
2+
d /run/pgbouncer 2775 postgres postgres - -

ansible/tasks/setup-pgbouncer.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,6 @@
88
update_cache: yes
99
cache_valid_time: 3600
1010

11-
- name: Create directory for pgbouncer.pid
12-
file:
13-
path: /var/run/pgbouncer
14-
state: directory
15-
owner: postgres
16-
group: postgres
17-
1811
- name: PgBouncer - download latest release
1912
get_url:
2013
url: "https://www.pgbouncer.org/downloads/files/{{ pgbouncer_release }}/pgbouncer-{{ pgbouncer_release }}.tar.gz"
@@ -57,6 +50,19 @@
5750
src: files/pgbouncer_config/pgbouncer.ini.j2
5851
dest: /etc/pgbouncer/pgbouncer.ini
5952

53+
- name: PgBouncer - create a directory if it does not exist
54+
file:
55+
path: /etc/pgbouncer/userlist.txt
56+
state: touch
57+
group: postgres
58+
owner: postgres
59+
60+
- name: import /etc/tmpfiles.d/pgbouncer.conf
61+
template:
62+
src: files/pgbouncer_config/tmpfiles.d-pgbouncer.conf.j2
63+
dest: /etc/tmpfiles.d/pgbouncer.conf
64+
become: yes
65+
6066
# Add systemd file for PgBouncer
6167
- name: PgBouncer - import postgresql.service
6268
template:

0 commit comments

Comments
 (0)