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.

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