From 54629a46bda44b3d9cf90a5eb54ffc957e1bf157 Mon Sep 17 00:00:00 2001 From: Julien DOCHE Date: Fri, 19 Feb 2021 00:12:51 +0100 Subject: [PATCH 1/2] Change reset deletion order to avoid racecondition If the k3s binary is launched after the deletion of `/var/lib/rancher/k3s`, k3s will automatically create this directory. This change deletes the k3s binary first so that it cannot be called after `/var/lib/rancher/k3s` is deleted Signed-off-by: Julien DOCHE --- roles/reset/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/reset/tasks/main.yml b/roles/reset/tasks/main.yml index 38560c5..728447f 100644 --- a/roles/reset/tasks/main.yml +++ b/roles/reset/tasks/main.yml @@ -30,12 +30,12 @@ name: "{{ item }}" state: absent with_items: + - /usr/local/bin/k3s - "{{ systemd_dir }}/k3s.service" - "{{ systemd_dir }}/k3s-node.service" - /etc/rancher/k3s - /var/lib/kubelet - /var/lib/rancher/k3s - - /usr/local/bin/k3s - name: daemon_reload systemd: From 88e1a435434ab22998e578a4b2cc079bef9163a4 Mon Sep 17 00:00:00 2001 From: Julien DOCHE Date: Fri, 19 Feb 2021 00:19:50 +0100 Subject: [PATCH 2/2] Make sure the reset role can be run with --check We need to compute what mountpoints would be unmounted even when running with --check Signed-off-by: Julien DOCHE --- roles/reset/tasks/umount_with_children.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/reset/tasks/umount_with_children.yml b/roles/reset/tasks/umount_with_children.yml index 6e1f4bf..5883b70 100644 --- a/roles/reset/tasks/umount_with_children.yml +++ b/roles/reset/tasks/umount_with_children.yml @@ -6,6 +6,7 @@ executable: /bin/bash failed_when: false changed_when: get_mounted_filesystems.stdout | length > 0 + check_mode: false - name: Umount filesystem mount: