diff --git a/roles/installer/tasks/migrate_data.yml b/roles/installer/tasks/migrate_data.yml index 1f83d8f3..923fe094 100644 --- a/roles/installer/tasks/migrate_data.yml +++ b/roles/installer/tasks/migrate_data.yml @@ -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