From 6f596c47dcfde2701d0038826f39fadf1172ddc5 Mon Sep 17 00:00:00 2001 From: Ben Partridge Date: Wed, 13 Nov 2019 16:23:51 +1100 Subject: [PATCH 1/2] DCD-798: name dump as tar file and specify custom format in db_restore to workaround module not supporting custom pg_dump format --- roles/restore_backups/tasks/main.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/roles/restore_backups/tasks/main.yml b/roles/restore_backups/tasks/main.yml index 1f9ebdb..57cd47f 100644 --- a/roles/restore_backups/tasks/main.yml +++ b/roles/restore_backups/tasks/main.yml @@ -76,7 +76,9 @@ overwrite: different bucket: "{{ atl_backup_manifest.artifacts.sharedHome.location.location | urlsplit('hostname') }}" object: "{{ atl_backup_manifest.artifacts.sharedHome.location.location | urlsplit('path') }}" - dest: "{{ atl_backup_home_dest }}" + # We save the backup as a .tar file so that the postgresql_db module uses pg_restore instead of psql to do restore + # This can be removed when ansible 2.10 is released + dest: "{{ atl_backup_home_dest }}.tar" - name: Install distro-specific restore support packages include_tasks: "{{ ansible_distribution|lower }}.yml" @@ -96,7 +98,8 @@ template: "{{ atl_jdbc_template }}" # Depends on fetch_backup roles state: restore - target: "{{ atl_backup_db_dest }}" + target: "{{ atl_backup_db_dest }}.tar" + target_opts: "-Fc" register: result # managed DBs in cloud providers are not allowing full root access to the DB engine, we can safely ignore the COMMENT ON EXTENSION error failed_when: From e648c9722131b1b4238296c524c5dd0b2bc39382 Mon Sep 17 00:00:00 2001 From: Ben Partridge Date: Mon, 18 Nov 2019 10:39:28 +1100 Subject: [PATCH 2/2] DCD-798: Fix saving shared home archive as tar instead of db dump when fetchin from S3 --- roles/restore_backups/tasks/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/roles/restore_backups/tasks/main.yml b/roles/restore_backups/tasks/main.yml index 57cd47f..f743e6b 100644 --- a/roles/restore_backups/tasks/main.yml +++ b/roles/restore_backups/tasks/main.yml @@ -68,7 +68,9 @@ overwrite: different bucket: "{{ atl_backup_manifest.artifacts.db.location.location | urlsplit('hostname') }}" object: "{{ atl_backup_manifest.artifacts.db.location.location | urlsplit('path') }}" - dest: "{{ atl_backup_db_dest }}" + # We save the backup as a .tar file so that the postgresql_db module uses pg_restore instead of psql to do restore + # This can be removed when ansible 2.10 is released + dest: "{{ atl_backup_db_dest }}.tar" - name: Fetch Home backup from S3 aws_s3: @@ -76,9 +78,7 @@ overwrite: different bucket: "{{ atl_backup_manifest.artifacts.sharedHome.location.location | urlsplit('hostname') }}" object: "{{ atl_backup_manifest.artifacts.sharedHome.location.location | urlsplit('path') }}" - # We save the backup as a .tar file so that the postgresql_db module uses pg_restore instead of psql to do restore - # This can be removed when ansible 2.10 is released - dest: "{{ atl_backup_home_dest }}.tar" + dest: "{{ atl_backup_home_dest }}" - name: Install distro-specific restore support packages include_tasks: "{{ ansible_distribution|lower }}.yml"