Skip to content

Commit

Permalink
upgrade: Ensure correct permissions for PgBouncer unix socket directory
Browse files Browse the repository at this point in the history
  • Loading branch information
vitabaks committed Jan 5, 2024
1 parent 608d430 commit cea4a6b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
3 changes: 2 additions & 1 deletion roles/upgrade/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ Please see the variable file vars/[upgrade.yml](../../vars/upgrade.yml)
- Print tablespace location (if exists)
- Note: If tablespaces are present they will be upgraded (step 5) on replicas using rsync
- **Test PgBouncer access via unix socket**
- test access via unix socket to be able to perform 'PAUSE' command
- Ensure correct permissions for PgBouncer unix socket directory
- Test access via unix socket to be able to perform 'PAUSE' command
- **Make sure that the cluster ip address (VIP) is running**
- Notes: if 'cluster_vip' is defined

Expand Down
1 change: 0 additions & 1 deletion roles/upgrade/tasks/pgbouncer_pause.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
loop_control:
index_var: idx
label: "{{ 'pgbouncer' if idx == 0 else 'pgbouncer-%d' % (idx + 1) }}"
when: ansible_os_family == "RedHat" # Added to prevent test failures in CI.

- name: PAUSE PgBouncer pools
become: true
Expand Down
19 changes: 18 additions & 1 deletion roles/upgrade/tasks/pre_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,24 @@
- tablespace_location.stdout_lines | length > 0

# PgBouncer (if 'pgbouncer_pool_pause' is 'true')
# test access via unix socket to be able to perform 'PAUSE' command
- name: Ensure correct permissions for PgBouncer unix socket directory
become: true
become_user: root
ansible.builtin.file:
path: "/var/run/pgbouncer{{ '-%d' % (idx + 1) if idx > 0 else '' }}"
state: directory
owner: postgres
group: postgres
mode: "0755"
loop: "{{ range(0, (pgbouncer_processes | default(1) | int)) | list }}"
loop_control:
index_var: idx
label: "{{ 'pgbouncer' if idx == 0 else 'pgbouncer-%d' % (idx + 1) }}"
when:
- pgbouncer_install | bool
- pgbouncer_pool_pause | bool

# Test access via unix socket to be able to perform 'PAUSE' command
- name: '[Pre-Check] Test PgBouncer access via unix socket'
ansible.builtin.command: >-
psql -h /var/run/pgbouncer{{ '-%d' % (idx + 1) if idx > 0 else '' }}
Expand Down

0 comments on commit cea4a6b

Please sign in to comment.