scaleup_checks.yml 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. ---
  2. # This task file is run with import_role for localhost from scaleup.yml
  3. - name: Ensure [new_workers] group is populated
  4. fail:
  5. msg: >
  6. Detected no [new_workers] in inventory. Please add hosts to the
  7. [new_workers] host group to add nodes.
  8. when: groups.new_workers | default([]) | length == 0
  9. - name: Get cluster nodes
  10. command: >
  11. oc get nodes
  12. --kubeconfig={{ openshift_node_kubeconfig_path }}
  13. --output=name
  14. register: oc_get
  15. until:
  16. - oc_get.stdout != ''
  17. retries: 36
  18. delay: 5
  19. - name: Check for nodes which are already part of the cluster
  20. set_fact:
  21. openshift_node_active_nodes: "{{ openshift_node_active_nodes + [ item ] }}"
  22. when: "item in oc_get.stdout"
  23. loop: "{{ groups.new_workers }}"
  24. - name: Fail if new_workers group contains active nodes
  25. fail:
  26. msg: >
  27. Detected active nodes in [new_workers] group.
  28. Please move these nodes to the [workers] group.
  29. {{ openshift_node_active_nodes | join(', ') }}
  30. when: openshift_node_active_nodes | length > 0