Here with the following piece of code is waiting for the kubernetest pod to be disappeared after launch.
pod do disappeared but the script fails with the error.
I want to wait till pod disappeared and the continue with rest of the task.
- name: Check ms pod has disappeared
sudo: yes
run_once: true
when: ansible_hostname != "inception-{{ vms_subdomain }}"
shell: "kubectl get pod --namespace=vms | grep {{ item.key }}"
register: command_res
with_dict: "{{ microservices }}"
until: "command_res.rc == 1"
retries: 10
delay: 20
TASK [sp-sif : Check ms resouce has disappeared] *******************************
Tuesday 07 February 2017 15:26:52 +0000 (0:00:02.051) 0:03:23.889 ******
FAILED - RETRYING: TASK: sp-sif : Check ms resouce has disappeared (5 retries left).
FAILED - RETRYING: TASK: sp-sif : Check ms resouce has disappeared (4 retries left).
FAILED - RETRYING: TASK: sp-sif : Check ms resouce has disappeared (3 retries left).
failed: [kubernetes-master-vik202vmsservices-1] (item={‘key’: u’iwan’, ‘value’: {u’streams’: u’ncs-alarms’}}) => {“attempts”: 4, “changed”: true, “cmd”: “kubectl get pod --namespace=vms | grep iwanms”, “del
ta”: “0:00:00.048855”, “end”: “2017-02-07 15:28:26.707882”, “failed”: true, “item”: {“key”: “iwan”, “value”: {“streams”: “ncs-alarmsf”}}, “rc”: 1, “start”: “2017-02-07 15:28:26.659027”, “stderr”: “”, "stdout
": “”, “stdout_lines”: , “warnings”: }