<p>Is there any existing ansible module I can use for the following.
I can wait for <code>kubectl get nodes</code> <code>STATUS</code>=<code>Ready</code>?</p>
<pre><code>$ kubectl get nodes
NAME      STATUS     ROLES     AGE       VERSION
master1   NotReady   master    42s       v1.8.4
</code></pre>

DarVar
<h2> The <code>kubectl wait</code> command </h2>
<p>Kubernetes supports the use of <a href="https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#wait" rel="noreferrer">kubectl wait</a> from version v1.11.<br>
It waits for a specific condition on one or many resources.</p>
<p>Using the kubectl wait command with ansible tasks:</p>
<pre><code>  - name: Wait for all k8s nodes to be ready
    shell: kubectl wait --for=condition=Ready nodes --all --timeout=600s
    register: nodes_ready

  - debug: var=nodes_ready.stdout_lines
</code></pre>
<p>If you want to check the condition for some particular nodes only, you can use a <code>--selector</code> instead of <code>--all</code> like this:</p>
<pre><code>  - name: Wait for k8s nodes with node label 'purpose=test' to be ready
    shell: kubectl wait --for=condition=Ready nodes --selector purpose=test --timeout=600s
    register: nodes_ready

  - debug: var=nodes_ready.stdout_lines
</code></pre>
