2018-03-05 15:02:47 +08:00
|
|
|
---
|
2019-08-07 19:46:50 +08:00
|
|
|
- name: Lookup node IP in kubernetes
|
|
|
|
shell: >-
|
|
|
|
{{ bin_dir }}/kubectl get nodes {{ node }}
|
|
|
|
-o jsonpath='{range.status.addresses[?(@.type=="InternalIP")]}{.address}{"\n"}{end}'
|
|
|
|
register: remove_node_ip
|
|
|
|
when:
|
|
|
|
- inventory_hostname in groups['etcd']
|
|
|
|
- ip is not defined
|
|
|
|
- access_ip is not defined
|
|
|
|
delegate_to: "{{ groups['etcd']|first }}"
|
|
|
|
failed_when: false
|
|
|
|
|
2018-03-05 15:02:47 +08:00
|
|
|
- name: Delete node
|
2019-08-07 19:46:50 +08:00
|
|
|
command: "{{ bin_dir }}/kubectl delete node {{ inventory_hostname }}"
|
2018-06-23 14:40:59 +08:00
|
|
|
delegate_to: "{{ groups['kube-master']|first }}"
|
2018-03-05 15:02:47 +08:00
|
|
|
ignore_errors: yes
|