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.

49 lines
1.7 KiB

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