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:
2026-02-03 11:45:18 +01:00
parent a3091080ed
commit 871c7a9f7e

View File

@@ -19,6 +19,8 @@
when: when:
- item.value[5] in ['/bin/bash', '/bin/zsh', '/usr/bin/bash', '/usr/bin/zsh', '/usr/bin/fish'] - item.value[5] in ['/bin/bash', '/bin/zsh', '/usr/bin/bash', '/usr/bin/zsh', '/usr/bin/fish']
- item.value[0] != 'root' - item.value[0] != 'root'
- item.value[4] is defined
- item.value[4] | length > 1
- name: Display the list of collected home directories - name: Display the list of collected home directories
ansible.builtin.debug: ansible.builtin.debug: