store secrets & definitions in a tempfile dir, fix postgres label

This commit is contained in:
Christian M. Adams
2021-04-08 15:18:03 -04:00
parent 2cbf60fa17
commit 82efe05343
9 changed files with 34 additions and 39 deletions

View File

@@ -32,7 +32,7 @@
kind: Pod
namespace: '{{ meta.namespace }}'
label_selectors:
- "app={{ tower_name }}-{{ deployment_type }}-postgres"
- "app.kubernetes.io/name={{ tower_name }}-postgres"
register: postgres_pod
until: "postgres_pod['resources'][0]['status']['phase'] == 'Running'"
delay: 5
@@ -59,17 +59,23 @@
replicas: 0
when: this_deployment['resources'] | length
- name: Get the postgres pod information
set_fact:
resolvable_db_host: "{{ awx_postgres_host }}.{{ meta.namespace }}.svc.cluster.local"
- name: Set pg_restore command
set_fact:
psql_restore: >-
psql -U {{ awx_postgres_user }}
-d template1
-h {{ resolvable_db_host }}
-U {{ awx_postgres_user }}
-d {{ awx_postgres_database }}
-p {{ awx_postgres_port }}
- name: Restore database dump to the new postgresql container
k8s_exec:
namespace: "{{ meta.namespace }}"
pod: "{{ postgres_pod_name }}"
namespace: "{{ tower_backup_pvc_namespace }}"
pod: "{{ meta.name }}-db-management"
command: |
bash -c """
set -e -o pipefail