scaleup.yml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. ---
  2. - import_playbook: create_machines.yml
  3. - import_playbook: ../../playbooks/scaleup.yml
  4. vars:
  5. openshift_kubeconfig_path: "{{ kubeconfig_path }}"
  6. - name: Wait for nodes to join
  7. hosts: new_workers
  8. tasks:
  9. - block:
  10. - name: Wait for nodes to report ready
  11. command: >
  12. oc get node {{ hostvars[item].ansible_nodename | lower }}
  13. --kubeconfig={{ kubeconfig_path }}
  14. --output=jsonpath='{.status.conditions[?(@.type=="Ready")].status}'
  15. loop: "{{ ansible_play_batch }}"
  16. delegate_to: localhost
  17. run_once: true
  18. register: oc_get
  19. until:
  20. - oc_get.stdout == "True"
  21. retries: 36
  22. delay: 5
  23. changed_when: false
  24. rescue:
  25. - include_tasks: tasks/gather_logs.yml
  26. - name: DEBUG - Node failed to report ready
  27. fail:
  28. msg: "Node failed to report Ready"
  29. - name: Remove CoreOS nodes
  30. hosts: localhost
  31. connection: local
  32. tasks:
  33. - block:
  34. - name: Wait for worker configs to roll out
  35. command: >
  36. oc wait machineconfigpool/worker
  37. --kubeconfig={{ kubeconfig_path }}
  38. --for=condition=Updated
  39. --timeout=10m
  40. rescue:
  41. - name: DEBUG - Get worker machine config pool
  42. command: >
  43. oc get machineconfigpool/worker
  44. --kubeconfig={{ kubeconfig_path }}
  45. --output=json
  46. - name: DEBUG - Worker config rollout failed
  47. fail:
  48. msg: "Worker config rollout failed"
  49. - name: Mark pre-scaleup worker nodes as unschedulable
  50. command: >
  51. oc adm cordon {{ item | lower }}
  52. --kubeconfig={{ kubeconfig_path }}
  53. loop: "{{ pre_scaleup_workers_name }}"
  54. - name: Drain pre-scaleup worker nodes
  55. command: >
  56. oc adm drain {{ item | lower }}
  57. --kubeconfig={{ kubeconfig_path }}
  58. --force --delete-local-data --ignore-daemonsets
  59. --timeout=0s
  60. loop: "{{ pre_scaleup_workers_name }}"
  61. - name: Remove pre-scaleup machinesets
  62. command: >
  63. oc delete machinesets {{ item }}
  64. --kubeconfig={{ kubeconfig_path }}
  65. --namespace=openshift-machine-api
  66. loop: "{{ pre_scaleup_machineset_names }}"