ansible kubectl wait for nodes to be READY

11/22/2017

Is there any existing ansible module I can use for the following. I can wait for kubectl get nodes STATUS\=Ready?

$ kubectl get nodes NAME STATUS ROLES AGE VERSION master1 NotReady master 42s v1.8.4

-- DarVar
ansible
kubernetes

1 Answer

11/23/2017

I didn't know any existing module for this. you can do something like this.

---
- hosts: localhost
  gather_facts: no
  tasks:
  - name: Wait for nodes to be ready
    shell: "/usr/bin/kubectl get nodes"
    register: nodes
    until:      
      - '" Ready "  in nodes.stdout'      
    retries: 6
    delay: 2
-- sfgroups
Source: StackOverflow