v1.0
This commit is contained in:
28
roles/replication/tasks/main.yml
Normal file
28
roles/replication/tasks/main.yml
Normal file
@@ -0,0 +1,28 @@
|
||||
- name: Create replicator user (on primary)
|
||||
delegate_to: pg1
|
||||
become_user: postgres
|
||||
postgresql_user:
|
||||
name: replicator
|
||||
password: "{{ replicator_password }}"
|
||||
role_attr_flags: REPLICATION,LOGIN
|
||||
|
||||
- name: Stop postgres
|
||||
service:
|
||||
name: postgresql
|
||||
state: stopped
|
||||
|
||||
- name: Remove old data
|
||||
file:
|
||||
path: "{{ pg_data }}"
|
||||
state: absent
|
||||
|
||||
- name: Base backup
|
||||
become_user: postgres
|
||||
command: >
|
||||
pg_basebackup -h pg1 -D {{ pg_data }}
|
||||
-U replicator -Fp -Xs -P -R
|
||||
|
||||
- name: Start postgres
|
||||
service:
|
||||
name: postgresql
|
||||
state: started
|
||||
Reference in New Issue
Block a user