Robert Kaussow
2a5e12dcad
All checks were successful
continuous-integration/drone/push Build is passing
64 lines
1.6 KiB
YAML
64 lines
1.6 KiB
YAML
---
|
|
- block:
|
|
- name: Disable services
|
|
service:
|
|
name: "{{ item }}"
|
|
state: stopped
|
|
enabled: False
|
|
failed_when: False
|
|
loop:
|
|
- k3s
|
|
- k3s-init
|
|
- kubepods
|
|
|
|
- name: Kill containerd-shim-runc
|
|
register: __k3s_pkill_containerd_shim_runc
|
|
command: pkill -9 -f "k3s/data/[^/]+/bin/containerd-shim-runc"
|
|
changed_when: __k3s_pkill_containerd_shim_runc.rc == 0
|
|
failed_when: False
|
|
|
|
- name: Get the list of mounted filesystems
|
|
shell: set -o pipefail && cat /proc/mounts | awk '{ print $2}' | grep -E "^{{ item }}"
|
|
loop:
|
|
- /run/k3s
|
|
- /var/lib/kubelet
|
|
- /run/netns
|
|
- /var/lib/kubelet/pods
|
|
- /var/lib/kubelet/plugins
|
|
- /run/netns/cni-
|
|
- "{{ __k3s_data_dir }}"
|
|
register: __k3s_mounted_fs
|
|
args:
|
|
executable: /bin/bash
|
|
failed_when: False
|
|
changed_when: False
|
|
|
|
- name: Umount filesystem
|
|
mount:
|
|
path: "{{ item }}"
|
|
state: unmounted
|
|
loop: "{{ __k3s_mounted_fs.results | map(attribute='stdout_lines') | list | flatten | reverse }}"
|
|
|
|
- name: Remove service files, binaries and data
|
|
file:
|
|
name: "{{ item }}"
|
|
state: absent
|
|
loop:
|
|
- /usr/local/bin/k3s
|
|
- "{{ __k3s_service_file }}"
|
|
- "{{ __k3s_config_dir }}"
|
|
- "{{ __k3s_data_dir }}"
|
|
- "{{ __k3s_log_dir }}"
|
|
- /etc/cni
|
|
- /run/k3s
|
|
- /run/flannel
|
|
- /var/lib/kubelet
|
|
- /var/lib/cni
|
|
- /var/run/netns
|
|
|
|
- name: Reload systemd daemon
|
|
systemd:
|
|
daemon_reload: True
|
|
become: True
|
|
become_user: root
|