2017-11-12 14:54:20 +08:00
|
|
|
- hosts: kube-cluster
|
|
|
|
gather_facts: False
|
|
|
|
tasks:
|
|
|
|
- name: stop calico-node service
|
|
|
|
shell: "systemctl stop calico-node docker"
|
|
|
|
ignore_errors: true
|
|
|
|
|
|
|
|
- name: 清理目录和文件
|
|
|
|
file: name={{ item }} state=absent
|
|
|
|
with_items:
|
|
|
|
- "/etc/cni/"
|
|
|
|
- "/etc/calico/ssl/"
|
|
|
|
- "/var/run/calico/"
|
|
|
|
- "/var/log/calico/"
|
|
|
|
- "/var/lib/docker/"
|
|
|
|
- "/var/run/docker/"
|
|
|
|
- "/etc/systemd/system/calico-node.service"
|
|
|
|
- "/etc/systemd/system/docker.service"
|
|
|
|
|
|
|
|
- name: 清理 iptables
|
|
|
|
shell: iptables -F && iptables -X && iptables -F -t nat && iptables -X -t nat
|
|
|
|
|
|
|
|
- name: 清理网络
|
|
|
|
shell: "ip link del docker0; ip link del tunl0"
|
|
|
|
ignore_errors: true
|
|
|
|
|
2017-11-11 19:14:21 +08:00
|
|
|
- hosts: kube-node
|
|
|
|
gather_facts: False
|
|
|
|
tasks:
|
|
|
|
- name: stop kube-node service
|
2017-11-12 14:54:20 +08:00
|
|
|
shell: "systemctl stop kubelet kube-proxy"
|
2017-11-11 19:14:21 +08:00
|
|
|
ignore_errors: true
|
|
|
|
|
|
|
|
- name: umount kubelet 挂载的目录
|
|
|
|
shell: "mount | grep '/var/lib/kubelet'| awk '{print $3}'|xargs umount"
|
|
|
|
ignore_errors: true
|
|
|
|
|
|
|
|
- name: 清理目录和文件
|
|
|
|
file: name={{ item }} state=absent
|
|
|
|
with_items:
|
|
|
|
- "/var/lib/kubelet/"
|
|
|
|
- "/etc/kubernetes/"
|
|
|
|
- "/etc/systemd/system/kubelet.service"
|
|
|
|
- "/etc/systemd/system/kube-proxy.service"
|
|
|
|
# - "/root/local/bin/"
|
|
|
|
|
|
|
|
- hosts: kube-master
|
|
|
|
gather_facts: False
|
|
|
|
tasks:
|
|
|
|
- name: stop kube-master service
|
2017-11-12 14:54:20 +08:00
|
|
|
shell: "systemctl stop kube-apiserver kube-controller-manager kube-scheduler"
|
2017-11-11 19:14:21 +08:00
|
|
|
ignore_errors: true
|
|
|
|
|
|
|
|
- name: 清理目录和文件
|
|
|
|
file: name={{ item }} state=absent
|
|
|
|
with_items:
|
|
|
|
- "/var/run/kubernetes"
|
|
|
|
- "/etc/systemd/system/kube-apiserver.service"
|
|
|
|
- "/etc/systemd/system/kube-controller-manager.service"
|
|
|
|
- "/etc/systemd/system/kube-scheduler.service"
|
|
|
|
- "/etc/kubernetes/"
|
|
|
|
|
|
|
|
- hosts: etcd
|
|
|
|
gather_facts: False
|
|
|
|
tasks:
|
|
|
|
- name: stop etcd service
|
|
|
|
shell: systemctl stop etcd
|
|
|
|
ignore_errors: true
|
|
|
|
|
|
|
|
- name: 清理目录和文件
|
|
|
|
file: name={{ item }} state=absent
|
|
|
|
with_items:
|
|
|
|
- "/var/lib/etcd"
|
|
|
|
- "/etc/etcd/"
|
|
|
|
- "/etc/systemd/system/etcd.service"
|
|
|
|
|
|
|
|
- hosts: lb
|
|
|
|
gather_facts: False
|
|
|
|
tasks:
|
|
|
|
- name: stop keepalived service
|
|
|
|
shell: systemctl disable keepalived && systemctl stop keepalived
|
|
|
|
ignore_errors: true
|
|
|
|
|
|
|
|
- name: stop haproxy service
|
|
|
|
shell: systemctl disable haproxy && systemctl stop haproxy
|
|
|
|
ignore_errors: true
|
|
|
|
|
|
|
|
- name: 清理LB 配置文件目录
|
|
|
|
file: name={{ item }} state=absent
|
|
|
|
with_items:
|
|
|
|
- "/etc/haproxy"
|
|
|
|
- "/etc/keepalived"
|
|
|
|
ignore_errors: true
|
|
|
|
|