-
-
Notifications
You must be signed in to change notification settings - Fork 357
/
main.yml
39 lines (35 loc) · 1.17 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
---
- name: Restart pgbouncer service
ansible.builtin.systemd:
name: pgbouncer{{ '-%d' % (idx + 1) if idx > 0 else '' }}
enabled: true
state: restarted
loop: "{{ range(0, (pgbouncer_processes | default(1) | int)) | list }}"
loop_control:
index_var: idx
label: "{{ 'pgbouncer' if idx == 0 else 'pgbouncer-%d' % (idx + 1) }}"
register: pgbouncer_restart_result
retries: 3
delay: 5
until: pgbouncer_restart_result is success
listen: "restart pgbouncer"
- name: Wait for port "{{ pgbouncer_listen_port }}" to become open on the host
ansible.builtin.wait_for:
port: "{{ pgbouncer_listen_port }}"
host: "{{ inventory_hostname }}"
state: started
timeout: 120
delay: 5
ignore_errors: false
listen: "restart pgbouncer"
- name: Reload pgbouncer service
ansible.builtin.systemd:
name: pgbouncer{{ '-%d' % (idx + 1) if idx > 0 else '' }}
state: reloaded
loop: "{{ range(0, (pgbouncer_processes | default(1) | int)) | list }}"
loop_control:
index_var: idx
label: "{{ 'pgbouncer' if idx == 0 else 'pgbouncer-%d' % (idx + 1) }}"
listen: "reload pgbouncer"
ignore_errors: true # Added to prevent test failures in CI.
...