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.

36 lines
1.2 KiB

  1. ---
  2. - name: Testcases checking nodes
  3. hosts: kube_control_plane[0]
  4. tasks:
  5. - name: Force binaries directory for Flatcar Container Linux by Kinvolk
  6. set_fact:
  7. bin_dir: "/opt/bin"
  8. when: ansible_os_family in ["Flatcar", "Flatcar Container Linux by Kinvolk"]
  9. - name: Force binaries directory for other hosts
  10. set_fact:
  11. bin_dir: "/usr/local/bin"
  12. when: not ansible_os_family in ["Flatcar", "Flatcar Container Linux by Kinvolk"]
  13. - import_role: # noqa name[missing]
  14. name: cluster-dump
  15. - name: Check kubectl output
  16. command: "{{ bin_dir }}/kubectl get nodes"
  17. changed_when: false
  18. register: get_nodes
  19. no_log: true
  20. - debug: # noqa name[missing]
  21. msg: "{{ get_nodes.stdout.split('\n') }}"
  22. - name: Check that all nodes are running and ready
  23. command: "{{ bin_dir }}/kubectl get nodes --no-headers -o yaml"
  24. changed_when: false
  25. register: get_nodes_yaml
  26. until:
  27. # Check that all nodes are Status=Ready
  28. - '(get_nodes_yaml.stdout | from_yaml)["items"] | map(attribute = "status.conditions") | map("items2dict", key_name="type", value_name="status") | map(attribute="Ready") | list | min'
  29. retries: 30
  30. delay: 10