diff --git a/roles/restore/tasks/postgres.yml b/roles/restore/tasks/postgres.yml index bbf91b72..c307114e 100644 --- a/roles/restore/tasks/postgres.yml +++ b/roles/restore/tasks/postgres.yml @@ -27,23 +27,24 @@ postgres_label_selector: "app.kubernetes.io/instance=postgres-{{ deployment_name }}" when: postgres_label_selector is not defined -- name: Get the postgres pod information - k8s_info: - kind: Pod - namespace: '{{ ansible_operator_meta.namespace }}' - label_selectors: - - "{{ postgres_label_selector }}" - register: postgres_pod - until: - - "postgres_pod['resources'] | length" - - "postgres_pod['resources'][0]['status']['phase'] == 'Running'" - - "postgres_pod['resources'][0]['status']['containerStatuses'][0]['ready'] == true" - delay: 5 - retries: 60 - -- name: Set the resource pod name as a variable. - set_fact: - postgres_pod_name: "{{ postgres_pod['resources'][0]['metadata']['name'] }}" +- block: + - name: Get the postgres pod information + k8s_info: + kind: Pod + namespace: '{{ ansible_operator_meta.namespace }}' + label_selectors: + - "{{ postgres_label_selector }}" + register: postgres_pod + until: + - "postgres_pod['resources'] | length" + - "postgres_pod['resources'][0]['status']['phase'] == 'Running'" + - "postgres_pod['resources'][0]['status']['containerStatuses'][0]['ready'] == true" + delay: 5 + retries: 60 + - name: Set the resource pod name as a variable. + set_fact: + postgres_pod_name: "{{ postgres_pod['resources'][0]['metadata']['name'] }}" + when: awx_postgres_type == 'managed' - name: Check for presence of AWX Deployment k8s_info: