blob: 043bec9a87a55d583a0b9d85569cd31bcc1c6781 [file] [log] [blame]
Hyunsun Moone4848342020-02-16 04:28:55 -08001# Copyright 2020-present Open Networking Foundation
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15---
16- name: Remove containers
17 shell: |
18 docker stop $(docker ps -aq)
19 docker system prune -f
20 docker volume rm $(docker volume ls -q)
21 docker image rm $(docker image ls -q)
22 register: remove_all_containers
23 retries: 4
24 delay: 5
25 until: remove_all_containers.rc == 0
Hyunsun Moon6c6db952020-03-04 20:50:51 -080026 changed_when: False
Hyunsun Moone4848342020-02-16 04:28:55 -080027 tags: k8s
28
29- name: Remove directories
30 file:
31 path: "{{ item }}"
32 state: absent
33 ignore_errors: yes
34 with_items:
35 - /etc/kubernetes
36 - /etc/cni
37 - /opt/cni
38 - /opt/rke
39 - /run/secrets/kubernetes.io
40 - /run/calico
41 - /var/lib/calico
42 - /var/lib/etcd
43 - /var/lib/cni
44 - /var/lib/kubelet
45 - /var/lib/rancher/rke/log
46 - /var/log/containers
47 - /var/log/pods
48 - /var/run/calico
Hyunsun Moon6c6db952020-03-04 20:50:51 -080049 changed_when: False
Hyunsun Moone4848342020-02-16 04:28:55 -080050 tags: k8s