This commit is contained in:
2026-01-29 12:55:01 +01:00
commit 65edf17dc7
15 changed files with 435 additions and 0 deletions

View 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