Dont require database names to match when doing migration

This commit is contained in:
Shane McDonald
2021-03-18 11:03:03 -04:00
parent 64c10f29c4
commit 79534a1465
3 changed files with 21 additions and 11 deletions

View File

@@ -14,6 +14,21 @@
name: '{{ meta.name }}-postgres-configuration'
register: _default_pg_config_resources
- name: Check for old PostgreSQL configuration secret
k8s_info:
kind: Secret
namespace: '{{ meta.namespace }}'
name: '{{ tower_old_postgres_configuration_secret }}'
register: old_pg_config
when: tower_old_postgres_configuration_secret | length
- name: Set proper database name when migrating from old deployment
set_fact:
database_name: "{{ old_pg_config['resources'][0]['data']['database'] | b64decode }}"
database_username: "{{ old_pg_config['resources'][0]['data']['username'] | b64decode }}"
when:
- old_pg_config['resources'][0]['data']['database'] is defined
- name: Set PostgreSQL configuration
set_fact:
_pg_config: '{{ _custom_pg_config_resources["resources"] | default([]) | length | ternary(_custom_pg_config_resources, _default_pg_config_resources) }}'
@@ -51,7 +66,7 @@
awx_postgres_port: "{{ pg_config['resources'][0]['data']['port'] | b64decode }}"
awx_postgres_host: "{{ pg_config['resources'][0]['data']['host'] | b64decode }}"
- name: Check to see if this instance has already been migrated
- name: Look up details for this deployment
k8s_info:
api_version: 'v1beta1' # TODO: How to parameterize this?
kind: "AWX" # TODO: How to parameterize this?
@@ -59,14 +74,6 @@
namespace: "{{ meta.namespace }}"
register: this_awx
- name: Check for old PostgreSQL configuration secret
k8s_info:
kind: Secret
namespace: '{{ meta.namespace }}'
name: '{{ tower_old_postgres_configuration_secret }}'
register: old_pg_config
when: tower_old_postgres_configuration_secret | length
- name: Migrate data from old Openshift instance
import_tasks: migrate_data.yml
when: