From 1a50a1a7330dfe413597c83136d7dd3f84f07252 Mon Sep 17 00:00:00 2001 From: Ganesh Maharaj Mahalingam Date: Wed, 12 Dec 2018 01:59:55 -0800 Subject: [PATCH] cri-o reset all containers and pods (#3856) Signed-off-by: Ganesh Maharaj Mahalingam --- roles/reset/tasks/main.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/roles/reset/tasks/main.yml b/roles/reset/tasks/main.yml index eeb2248c6..2bc48db8d 100644 --- a/roles/reset/tasks/main.yml +++ b/roles/reset/tasks/main.yml @@ -67,6 +67,17 @@ tags: - docker +- name: reset | stop all cri-o containers + shell: "crictl ps -aq | xargs -r crictl stop" + register: remove_all_crio_containers + retries: 4 + until: remove_all_crio_containers.rc == 0 + delay: 5 + tags: + - crio + when: container_manager == 'crio' + + - name: reset | remove all cri-o containers shell: "crictl ps -aq | xargs -r crictl rm" register: remove_all_crio_containers @@ -77,6 +88,25 @@ - crio when: container_manager == 'crio' and deploy_container_engine|default(true) +- name: reset | stop all cri-o pods + shell: "crictl pods -q | xargs -r crictl stopp" + register: remove_all_crio_containers + retries: 4 + until: remove_all_crio_containers.rc == 0 + delay: 5 + tags: + - crio + when: container_manager == 'crio' + +- name: reset | remove all cri-o pods + shell: "crictl pods -q | xargs -r crictl rmp" + register: remove_all_crio_containers + retries: 4 + until: remove_all_crio_containers.rc == 0 + delay: 5 + tags: + - crio + when: container_manager == 'crio' - name: reset | gather mounted kubelet dirs shell: mount | grep /var/lib/kubelet/ | awk '{print $3}' | tac args: