Use custom pg_dump format for faster restores

This commit is contained in:
Christian M. Adams
2021-05-17 16:54:49 -04:00
parent 1ce36572c4
commit f16d9ac55f
2 changed files with 5 additions and 3 deletions

View File

@@ -85,6 +85,7 @@
-U {{ awx_postgres_user }}
-d {{ awx_postgres_database }}
-p {{ awx_postgres_port }}
-F custom
- name: Write pg_dump to backup on PVC
k8s_exec:

View File

@@ -63,8 +63,9 @@
- name: Set pg_restore command
set_fact:
psql_restore: >-
psql -U {{ awx_postgres_user }}
pg_restore: >-
pg_restore --clean --if-exists
-U {{ awx_postgres_user }}
-h {{ resolvable_db_host }}
-U {{ awx_postgres_user }}
-d {{ awx_postgres_database }}
@@ -77,7 +78,7 @@
command: |
bash -c """
set -e -o pipefail
cat {{ backup_dir }}/tower.db | PGPASSWORD={{ awx_postgres_pass }} {{ psql_restore }}
cat {{ backup_dir }}/tower.db | PGPASSWORD={{ awx_postgres_pass }} {{ pg_restore }}
echo 'Successful'
"""
register: data_migration