Fix: Add robust filtering for user home directories
Modified 'roles/tmux/tasks/main.yml' to prevent invalid home
directories from being added to the 'user_home_dirs' list.
Added checks to ensure that the home directory path is defined
and has a length greater than 1, which excludes both empty paths
and the root directory ('/'). This resolves the 'chown failed'
error that occurred when the playbook was run on a system with
users having invalid home directory entries.
This commit is contained in:
@@ -19,6 +19,8 @@
|
||||
when:
|
||||
- item.value[5] in ['/bin/bash', '/bin/zsh', '/usr/bin/bash', '/usr/bin/zsh', '/usr/bin/fish']
|
||||
- item.value[0] != 'root'
|
||||
- item.value[4] is defined
|
||||
- item.value[4] | length > 1
|
||||
|
||||
- name: Display the list of collected home directories
|
||||
ansible.builtin.debug:
|
||||
|
||||
Reference in New Issue
Block a user