fix 99.clean.yml

pull/275/head
jmgao 2017-11-30 00:21:32 +08:00
parent 7bf48d26d7
commit b2c2bb9a98
1 changed files with 35 additions and 34 deletions

View File

@ -1,5 +1,40 @@
# 警告此脚本将清理真个K8S集群包括所有POD、ETCD数据等 # 警告此脚本将清理真个K8S集群包括所有POD、ETCD数据等
# 请三思后运行此脚本 ansible-playbook 99.clean.yml # 请三思后运行此脚本 ansible-playbook 99.clean.yml
- hosts: kube-node
tasks:
- name: stop kube-node service
shell: "systemctl stop kubelet kube-proxy"
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
tasks:
- name: stop kube-master service
shell: "systemctl stop kube-apiserver kube-controller-manager kube-scheduler"
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: kube-cluster - hosts: kube-cluster
tasks: tasks:
- name: stop calico-node service - name: stop calico-node service
@ -37,40 +72,6 @@
shell: "ip link del docker0; ip link del tunl0; systemctl restart networking" shell: "ip link del docker0; ip link del tunl0; systemctl restart networking"
ignore_errors: true ignore_errors: true
- hosts: kube-node
tasks:
- name: stop kube-node service
shell: "systemctl stop kubelet kube-proxy"
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
tasks:
- name: stop kube-master service
shell: "systemctl stop kube-apiserver kube-controller-manager kube-scheduler"
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 - hosts: etcd
tasks: tasks:
- name: stop etcd service - name: stop etcd service