Skip to content

Commit

Permalink
Remove immutable flag from /var/lib/kubelet subdirs (kubernetes-sigs#…
Browse files Browse the repository at this point in the history
…9597)

* Remove immutable flag from /var/lib/kubelet subdirs

* Find files before changing attributes
  • Loading branch information
emiran-orange authored and HoKim98 committed Mar 8, 2023
1 parent abe24c4 commit d104116
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions roles/reset/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
Expand Down

0 comments on commit d104116

Please sign in to comment.