Skip to content

Commit

Permalink
fix: uninstall contailer engine if service is running (kubernetes-sig…
Browse files Browse the repository at this point in the history
  • Loading branch information
cyril-corbon authored and sakuraiyuta committed Apr 16, 2022
1 parent 64392ad commit 085cd00
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions roles/container-engine/validate-container-engine/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
path: "/etc/systemd/system/kubelet.service"
register: kubelet_systemd_unit_exists

- name: Populate service facts
service_facts:

- name: Check if containerd is installed
find:
file_type: file
Expand Down Expand Up @@ -72,16 +75,17 @@
when:
- kubelet_systemd_unit_exists
- name: Remove Containerd
include_role:
import_role:
name: container-engine/containerd
apply:
tags:
- reset_containerd
tasks_from: reset
vars:
service_name: containerd.service
when:
- not (is_ostree or (ansible_distribution == "Flatcar Container Linux by Kinvolk") or (ansible_distribution == "Flatcar"))
- container_manager != "containerd"
- docker_installed.matched == 0
- containerd_installed.matched > 0
- ansible_facts.services[service_name]['state'] == 'running'

- name: Uninstall docker
block:
Expand All @@ -100,15 +104,16 @@
when:
- kubelet_systemd_unit_exists
- name: Remove Docker
include_role:
import_role:
name: container-engine/docker
apply:
tags:
- reset_docker
tasks_from: reset
vars:
service_name: docker.service
when:
- not (is_ostree or (ansible_distribution == "Flatcar Container Linux by Kinvolk") or (ansible_distribution == "Flatcar"))
- container_manager != "docker"
- docker_installed.matched > 0
- ansible_facts.services[service_name]['state'] == 'running'

- name: Uninstall crio
block:
Expand All @@ -127,12 +132,13 @@
when:
- kubelet_systemd_unit_exists
- name: Remove CRI-O
include_role:
name: container-engine/crio
apply:
tags:
- reset_crio
import_role:
name: container-engine/cri-o
tasks_from: reset
vars:
service_name: crio.service
when:
- not (is_ostree or (ansible_distribution == "Flatcar Container Linux by Kinvolk") or (ansible_distribution == "Flatcar"))
- container_manager != "crio"
- crio_installed.matched > 0
- ansible_facts.services[service_name]['state'] == 'running'

0 comments on commit 085cd00

Please sign in to comment.