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.

25 lines
1013 B

  1. ---
  2. - name: cordon-node | Mark all nodes as unschedulable before drain # noqa 301
  3. command: >-
  4. {{ bin_dir }}/kubectl cordon {{ hostvars[item]['kube_override_hostname']|default(item) }}
  5. with_items:
  6. - "{{ node.split(',') | default(groups['kube-node']) }}"
  7. failed_when: result.rc == 0 and not allow_ungraceful_removal
  8. delegate_to: "{{ groups['kube-master']|first }}"
  9. run_once: true
  10. ignore_errors: yes
  11. - name: remove-node | Drain node except daemonsets resource # noqa 301
  12. command: >-
  13. {{ bin_dir }}/kubectl --kubeconfig /etc/kubernetes/admin.conf drain
  14. --force
  15. --ignore-daemonsets
  16. --grace-period {{ drain_grace_period }}
  17. --timeout {{ drain_timeout }}
  18. --delete-local-data {{ hostvars[item]['kube_override_hostname']|default(item) }}
  19. with_items:
  20. - "{{ node.split(',') | default(groups['kube-node']) }}"
  21. failed_when: result.rc == 0 and not allow_ungraceful_removal
  22. delegate_to: "{{ groups['kube-master']|first }}"
  23. run_once: true
  24. ignore_errors: yes