You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.3 KiB

  1. ---
  2. - hosts: kube-master[0]
  3. tasks:
  4. - name: Force binaries directory for Container Linux by CoreOS
  5. set_fact:
  6. bin_dir: "/opt/bin"
  7. when: ansible_os_family in ["CoreOS", "Container Linux by CoreOS"]
  8. - set_fact:
  9. bin_dir: "/usr/local/bin"
  10. when: not ansible_os_family in ["CoreOS", "Container Linux by CoreOS"]
  11. - name: Check kubectl output
  12. shell: "{{bin_dir}}/kubectl get pods --all-namespaces -owide"
  13. register: get_pods
  14. no_log: true
  15. - debug: msg="{{get_pods.stdout.split('\n')}}"
  16. - name: Check that all pods are running and ready
  17. shell: "{{bin_dir}}/kubectl get pods --all-namespaces --no-headers -o yaml"
  18. register: run_pods_log
  19. until:
  20. # Check that all pods are running
  21. - '(run_pods_log.stdout | from_yaml)["items"] | map(attribute = "status.phase") | unique | list == ["Running"]'
  22. # Check that all pods are ready
  23. - '(run_pods_log.stdout | from_yaml)["items"] | map(attribute = "status.containerStatuses") | map("map", attribute = "ready") | map("min") | min'
  24. retries: 18
  25. delay: 10
  26. failed_when: false
  27. no_log: true
  28. - name: Check kubectl output
  29. shell: "{{bin_dir}}/kubectl get pods --all-namespaces -owide"
  30. register: get_pods
  31. no_log: true
  32. - debug: msg="{{get_pods.stdout.split('\n')}}"
  33. failed_when: not run_pods_log is success