From b722248ed7c4a7aba2b047855b983d72a9725209 Mon Sep 17 00:00:00 2001 From: Paul B Date: Thu, 28 May 2020 18:41:49 +0200 Subject: standby-clone: Allow cloning of standby server with pg_basebackup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Right now the role assumes you have a base backup available with Barman. However if you don't have an initial barman backup you might want to clone the primary server directly to setup your standby server. This PR adds a new `primary.pg_basebackup` option to the cluster configuration which if enabled (set to `true`) will create a `/root/standby-clone-{{ postgres_version }}-{{ postgres_cluster_name }}.sh` script on the standby server which helps to initialise a standby server. ⚠️ Breaking change: the current role behavior which creates a cloning script fetching the initial backup from barman will not be enabled by default anymore. You will need to add the new `primary.restore_barman_directory` option in your role configuration to do so. ⚠️ --- tasks/postgres-cluster.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tasks/postgres-cluster.yml') diff --git a/tasks/postgres-cluster.yml b/tasks/postgres-cluster.yml index a8e96c1..4f62d31 100644 --- a/tasks/postgres-cluster.yml +++ b/tasks/postgres-cluster.yml @@ -60,7 +60,11 @@ - name: Add standby clone from barman script include: postgres-standby-barman.yml - when: postgres_barman_server is defined + when: postgres_barman_server is defined and postgres_primary.restore_barman_directory is defined + +- name: Add standby clone from pg_basebackup + include: postgres-standby-basebackup.yml + when: postgres_primary and postgres_primary.pg_basebackup is defined - name: Determine SSD or rotational disks raw: 'lsblk --noheadings --nodeps --raw --output=rota | grep -q 1' -- cgit v1.2.3