mirror of https://github.com/easzlab/kubeasz.git
fix 容器化运行kubeasz时清理脚本
parent
0d8c47d95c
commit
c4eabdeb0c
54
99.clean.yml
54
99.clean.yml
|
@ -58,34 +58,32 @@
|
||||||
shell: 'docker ps|grep kubeasz || echo "NOT FOUND"'
|
shell: 'docker ps|grep kubeasz || echo "NOT FOUND"'
|
||||||
register: install_info
|
register: install_info
|
||||||
|
|
||||||
- name: fail info
|
- block:
|
||||||
fail: msg="you CAN NOT delete dockerd, because container 'kubeasz' is running!"
|
- name: stop and disable docker service
|
||||||
when: "'kubeasz' in install_info.stdout"
|
service:
|
||||||
|
name: docker
|
||||||
- name: stop and disable docker service
|
state: stopped
|
||||||
service:
|
enabled: no
|
||||||
name: docker
|
ignore_errors: true
|
||||||
state: stopped
|
|
||||||
enabled: no
|
# as k8s-network-plugins use host-network, '/var/run/docker/netns/default' must be umounted
|
||||||
ignore_errors: true
|
- name: unmount docker filesystem-1
|
||||||
|
mount: path=/var/run/docker/netns/default state=unmounted
|
||||||
# as k8s-network-plugins use host-network, '/var/run/docker/netns/default' must be umounted
|
|
||||||
- name: unmount docker filesystem-1
|
- name: unmount docker filesystem-2
|
||||||
mount: path=/var/run/docker/netns/default state=unmounted
|
mount: path=/var/lib/docker/overlay state=unmounted
|
||||||
|
|
||||||
- name: unmount docker filesystem-2
|
- name: remove files and dirs
|
||||||
mount: path=/var/lib/docker/overlay state=unmounted
|
file: name={{ item }} state=absent
|
||||||
|
with_items:
|
||||||
- name: remove files and dirs
|
- "/var/lib/docker/"
|
||||||
file: name={{ item }} state=absent
|
- "/var/run/docker/"
|
||||||
with_items:
|
- "/etc/systemd/system/docker.service"
|
||||||
- "/var/lib/docker/"
|
- "/etc/systemd/system/docker.service.requires/"
|
||||||
- "/var/run/docker/"
|
- "/etc/systemd/system/docker.service.d/"
|
||||||
- "/etc/systemd/system/docker.service"
|
- "/etc/bash_completion.d/docker"
|
||||||
- "/etc/systemd/system/docker.service.requires/"
|
- "/usr/bin/docker"
|
||||||
- "/etc/systemd/system/docker.service.d/"
|
when: "'kubeasz' not in install_info.stdout"
|
||||||
- "/etc/bash_completion.d/docker"
|
|
||||||
- "/usr/bin/docker"
|
|
||||||
when: CONTAINER_RUNTIME == 'docker'
|
when: CONTAINER_RUNTIME == 'docker'
|
||||||
|
|
||||||
- block:
|
- block:
|
||||||
|
|
Loading…
Reference in New Issue