---
- name: Checking {{ application_name }} pod is in running state
  shell: kubectl get pods -n {{ app_ns }} -o jsonpath='{.items[?(@.metadata.labels.{{app_lkey}}=="{{app_lvalue}}")].status.phase}'
  register: result
  until: "((result.stdout.split()|unique)|length) == 1 and 'Running' in result.stdout"
  delay: 3
  retries: 60

- name: Get the container status of application.
  shell: >
     kubectl get pod -n {{ app_ns }} -l {{app_lkey}}="{{app_lvalue}}"
     -o custom-columns=:..containerStatuses[].state --no-headers | grep -w "running"
  args:
    executable: /bin/bash
  register: containerStatus
  until: "'running' in containerStatus.stdout"
  delay: 3
  retries: 60
