-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpgsqlStandby.yaml
43 lines (37 loc) · 1.21 KB
/
pgsqlStandby.yaml
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
40
41
42
43
- hosts: pgsqlHA
roles:
- { role: postgresql, when: ansible_distribution == 'CentOS' and isnew|bool }
- { role: pgpool-ii, when: ansible_distribution == 'CentOS' }
tasks:
- name: Copy template .pgpass
include_tasks: roles/postgresql/tasks/pgpass.yaml
when: ansible_distribution == 'CentOS' and inventory_hostname in groups['pgsqlHA']
- block:
- name: Copy template pg_hba.conf.j2
include_tasks: roles/postgresql/tasks/pg_hba.yaml
- name: reload pgsql
shell: "/usr/pgsql-11/bin/pg_ctl reload -D {{ pgdata }}"
become: true
become_user: postgres
when: ansible_distribution == 'CentOS' and not isnew|bool
- hosts: pgsqlHA
tasks:
- name: reload pgpool
systemd:
name: pgpool
state: reloaded
when: ansible_distribution == 'CentOS' and not isnew|bool
- name: start pgpool
systemd:
name: pgpool
state: started
enabled: true
when: ansible_distribution == 'CentOS' and isnew|bool
- hosts: localhost
tasks:
- name: Replace pgsqlStandby['isnew'] with false in {{ inventory_file }}
replace:
path: "{{ inventory_file }}"
regexp: 'isnew=true'
replace: 'isnew=false'
when: ansible_distribution == 'CentOS'