Merge pull request #688 from rooftopcellist/wait-for-postgres

Wait for Postgres to initialize before starting containers
This commit is contained in:
Christian Adams
2021-12-08 14:56:48 -05:00
committed by GitHub

View File

@@ -138,6 +138,20 @@
awx_postgres_sslmode: "{{ pg_config['resources'][0]['data']['sslmode'] | default('prefer'|b64encode) | b64decode }}"
no_log: true
- name: Wait for Database to initialize
k8s_info:
kind: Pod
namespace: '{{ ansible_operator_meta.namespace }}'
name: '{{ ansible_operator_meta.name }}-postgres-0' # using name to keep compatibility
field_selectors:
- status.phase=Running
register: postgres_pod
until:
- "postgres_pod['resources'] | length"
- "postgres_pod['resources'][0]['status']['phase'] == 'Running'"
delay: 5
retries: 60
- name: Look up details for this deployment
k8s_info:
api_version: "{{ api_version }}"