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.

29 lines
983 B

  1. ---
  2. - name: Wait for apiserver
  3. shell: "{{ bin_dir }}/kubectl get nodes"
  4. environment:
  5. - KUBECONFIG: "{{ ansible_env.HOME | default('/root') }}/.kube/config"
  6. register: apiserver_is_ready
  7. until: apiserver_is_ready.rc == 0
  8. retries: 6
  9. delay: 10
  10. changed_when: false
  11. when: groups['broken_kube-master']
  12. - name: Delete broken kube-master nodes from cluster
  13. shell: "{{ bin_dir }}/kubectl delete node {{ item }}"
  14. environment:
  15. - KUBECONFIG: "{{ ansible_env.HOME | default('/root') }}/.kube/config"
  16. with_items: "{{ groups['broken_kube-master'] }}"
  17. register: delete_broken_kube_masters
  18. failed_when: false
  19. when: groups['broken_kube-master']
  20. - name: Fail if unable to delete broken kube-master nodes from cluster
  21. fail:
  22. msg: "Unable to delete broken kube-master node: {{ item.item }}"
  23. loop: "{{ delete_broken_kube_masters.results }}"
  24. changed_when: false
  25. when:
  26. - groups['broken_kube-master']
  27. - "item.rc != 0 and not 'NotFound' in item.stderr"