mirror of
https://github.com/ansible/awx-operator.git
synced 2026-04-07 19:23:11 +00:00
Merge pull request #296 from rooftopcellist/pg_custom_archive
Use custom archive format when migrating data
This commit is contained in:
@@ -41,18 +41,19 @@
|
||||
- name: Set pg_dump command
|
||||
set_fact:
|
||||
pgdump: >-
|
||||
pg_dump --clean --create
|
||||
pg_dump
|
||||
-h {{ awx_old_postgres_host }}
|
||||
-U {{ awx_old_postgres_user }}
|
||||
-d {{ awx_old_postgres_database }}
|
||||
-p {{ awx_old_postgres_port }}
|
||||
-F custom
|
||||
|
||||
- name: Set pg_restore command
|
||||
set_fact:
|
||||
psql_restore: >-
|
||||
psql -U {{ database_username }}
|
||||
-d template1
|
||||
-p {{ awx_postgres_port }}
|
||||
pg_restore: >-
|
||||
pg_restore --clean --if-exists
|
||||
-U {{ database_username }}
|
||||
-d {{ database_name }}
|
||||
|
||||
- name: Stream backup from pg_dump to the new postgresql container
|
||||
k8s_exec:
|
||||
@@ -61,7 +62,7 @@
|
||||
command: |
|
||||
bash -c """
|
||||
set -e -o pipefail
|
||||
PGPASSWORD={{ awx_old_postgres_pass }} {{ pgdump }} | PGPASSWORD={{ awx_postgres_pass }} {{ psql_restore }}
|
||||
PGPASSWORD={{ awx_old_postgres_pass }} {{ pgdump }} | PGPASSWORD={{ awx_postgres_pass }} {{ pg_restore }}
|
||||
echo 'Successful'
|
||||
"""
|
||||
register: data_migration
|
||||
|
||||
Reference in New Issue
Block a user