From 25f317233ce519ae4699c2504da97b5ddfaea062 Mon Sep 17 00:00:00 2001 From: emiran-orange <71817149+emiran-orange@users.noreply.github.com> Date: Thu, 22 Dec 2022 03:55:25 +0100 Subject: [PATCH] Remove immutable flag from /var/lib/kubelet subdirs (#9597) * Remove immutable flag from /var/lib/kubelet subdirs * Find files before changing attributes --- roles/reset/tasks/main.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/roles/reset/tasks/main.yml b/roles/reset/tasks/main.yml index 6405f4d38..24be4cda8 100644 --- a/roles/reset/tasks/main.yml +++ b/roles/reset/tasks/main.yml @@ -253,6 +253,25 @@ - enable_nodelocaldns|default(false)|bool - nodelocaldns_device.stat.exists +- name: reset | find files/dirs with immutable flag in /var/lib/kubelet + command: lsattr -laR /var/lib/kubelet + become: true + register: var_lib_kubelet_files_dirs_w_attrs + changed_when: false + no_log: true + +- name: reset | remove immutable flag from files/dirs in /var/lib/kubelet + file: + path: "{{ filedir_path }}" + state: touch + attributes: "-i" + loop: "{{ var_lib_kubelet_files_dirs_w_attrs.stdout_lines|select('search', 'Immutable')|list }}" + loop_control: + loop_var: file_dir_line + label: "{{ filedir_path }}" + vars: + filedir_path: "{{ file_dir_line.split(' ')[0] }}" + - name: reset | delete some files and directories file: path: "{{ item }}" -- GitLab