Check the default old PostgreSQL configuration

Signed-off-by: Julen Landa Alustiza <jlanda@redhat.com>
This commit is contained in:
Julen Landa Alustiza
2021-03-22 18:08:51 +01:00
parent b00de51fb9
commit 60199f79aa

View File

@@ -14,14 +14,26 @@
name: '{{ meta.name }}-postgres-configuration'
register: _default_pg_config_resources
- name: Check for old PostgreSQL configuration secret
- name: Check for specified old PostgreSQL configuration secret
k8s_info:
kind: Secret
namespace: '{{ meta.namespace }}'
name: '{{ tower_old_postgres_configuration_secret }}'
register: old_pg_config
register: _custom_old_pg_config_resources
when: tower_old_postgres_configuration_secret | length
- name: Check for default old PostgreSQL configuration
k8s_info:
kind: Secret
namespace: '{{ meta.namespace }}'
name: '{{ meta.name }}-old-postgres-configuration'
register: _default_old_pg_config_resources
- name: Set old PostgreSQL configuration
set_fact:
# yamllint disable-line rule:line-length
old_pg_config: '{{ _custom_old_pg_config_resources["resources"] | default([]) | length | ternary(_custom_old_pg_config_resources, _default_old_pg_config_resources) }}' # noqa 204
- name: Set proper database name when migrating from old deployment
set_fact:
database_name: "{{ old_pg_config['resources'][0]['data']['database'] | b64decode }}"