title: Ansible playbook wait until all pods running
body: <p>I have this ansible (working) playbook that looks at the output of <code>kubectl get pods -o json</code> until the pod is in the <code>Running</code> state.  Now I want to extend this to multiple pods.  The core issue is that the json result of the kubectl query is a list, I know how to access the first item, but not all of the items... </p>
  
  <pre><code>- name: wait for pods to come up
    shell: kubectl get pods -o json
    register: kubectl_get_pods
    until: kubectl_get_pods.stdout|from_json|json_query('items[0].status.phase') == "Running"
    retries: 20
  </code></pre>
  
  <p>The json object looks like,</p>
  
  <pre><code>[  { ...  "status": { "phase": "Running" } },
     { ...  "status": { "phase": "Running" } },
     ...
  ]
  </code></pre>
  
  <p>Using <code>[0]</code> to access the first item worked for handling one object in the list, but I can't figure out how to extend it to multiple items.  I tried <code>[*]</code> which did not work.</p>