Skip to content

Commit

Permalink
Merge pull request #66 from stafwag/master
Browse files Browse the repository at this point in the history
reset role updated to killall containerd daemons and umount k3s filesystems
  • Loading branch information
St0rmingBr4in authored Jul 26, 2020
2 parents 39632b7 + 7bab4cb commit ad3dc65
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
16 changes: 16 additions & 0 deletions roles/reset/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,22 @@
- k3s
- k3s-node

- name: pkill -9 -f "k3s/data/[^/]+/bin/containerd-shim-runc"
register: pkill_containerd_shim_runc
command: pkill -9 -f "k3s/data/[^/]+/bin/containerd-shim-runc"
changed_when: "pkill_containerd_shim_runc.rc == 0"
failed_when: false

- name: Umount k3s filesystems
include_tasks: umount_with_childeren.yml
with_items:
- /run/k3s
- /var/lib/kubelet
- /run/netns
- /var/lib/rancher/k3s
loop_control:
loop_var: mounted_fs

- name: Remove service files, binaries and data
file:
name: "{{ item }}"
Expand Down
15 changes: 15 additions & 0 deletions roles/reset/tasks/umount_with_childeren.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
- name: Get the list of mounted filesystems
shell: set -o pipefail && cat /proc/mounts | awk '{ print $2}' | grep -E "^{{ mounted_fs }}"
register: get_mounted_filesystems
args:
executable: /bin/bash
failed_when: false
changed_when: get_mounted_filesystems.stdout | length > 0

- name: Umount filesystem
mount:
path: "{{ item }}"
state: unmounted
with_items:
"{{ get_mounted_filesystems.stdout_lines }}"

0 comments on commit ad3dc65

Please sign in to comment.