-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathtower-setup-replication.yml
68 lines (56 loc) · 1.99 KB
/
tower-setup-replication.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
---
- name: set facts for pgsql-replication role and preflight check
hosts: database*
vars_files: tower-vars.yml
tasks:
- name: determine if db failover is managed by toolkit
when: not tower_db_external
block:
# OUTPUT tower_replication_master_address, tower_replication_replica_address_list
- name: perform tower replication pre-flight checks
include_role:
name: tower_replication_preflight
# end block
- name: Configure PostgreSQL on replicas
hosts: database_replica
become: true
vars_files: tower-vars.yml
tasks:
- name: determine if db failover is managed by toolkit
when: not tower_db_external
block:
- name: Install postgres database the Tower way
include_role:
name: tower_postgres_base
when: not (pgsqlrep_install_skip | default(False) | bool)
#end block
- name: Configure PSQL master server
hosts: database[0]
become: true
vars_files: tower-vars.yml
roles:
- role: "{{tower_installer_current}}/roles/postgres"
postgres_exec_vars_only: true
- role: samdoran.pgsql-replication
pgsqlrep_role: master
pgsqlrep_data_path: "{{ pg_conf_dir }}"
pgsqlrep_service: "{{ postgres_init_name }}"
pgsqlrep_master_address: "{{ tower_replication_master_address }}"
pgsqlrep_replica_address: "{{ tower_replication_replica_address_list }}"
pgsqlrep_bash: "{{ pg_bash | default('') }}"
when: not tower_db_external
- name: Configure PSQL replica
hosts: database_replica
become: true
vars_files: tower-vars.yml
roles:
- role: "{{tower_installer_current}}/roles/postgres"
postgres_exec_vars_only: true
- role: samdoran.pgsql-replication
pgsqlrep_role: replica
pgsqlrep_data_path: "{{ pg_conf_dir }}"
pgsqlrep_service: "{{ postgres_init_name }}"
pgsqlrep_master_address: "{{ tower_replication_master_address }}"
pgsqlrep_replica_address: "{{ tower_replication_replica_address_list }}"
pgsqlrep_bash: "{{ pg_bash | default('') }}"
when: not tower_db_external