Find files before changing attributes

This commit is contained in:
emiran-orange 2022-12-20 09:27:06 +01:00
parent 71d5485112
commit 37a4b28b64

View file

@ -253,12 +253,24 @@
- enable_nodelocaldns|default(false)|bool - enable_nodelocaldns|default(false)|bool
- nodelocaldns_device.stat.exists - nodelocaldns_device.stat.exists
- name: reset | Remove immutable flag from /var/lib/kubelet subdirs - 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: file:
path: /var/lib/kubelet path: "{{ filedir_path }}"
state: directory state: touch
attributes: "-i" attributes: "-i"
recurse: true 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 - name: reset | delete some files and directories
file: file: