fix: uninstall contailer engine if service is running (#8662)
This commit is contained in:
parent
78b05d0ffc
commit
1781eab21f
1 changed files with 19 additions and 13 deletions
|
@ -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
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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'
|
||||
|
|
Loading…
Reference in a new issue