From 871c7a9f7e85f41dd9d7fcc4c2bdc692b4597b85 Mon Sep 17 00:00:00 2001 From: jonnybravo Date: Tue, 3 Feb 2026 11:45:18 +0100 Subject: [PATCH] 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. --- roles/tmux/tasks/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/roles/tmux/tasks/main.yml b/roles/tmux/tasks/main.yml index 9beaef7..805bbc4 100644 --- a/roles/tmux/tasks/main.yml +++ b/roles/tmux/tasks/main.yml @@ -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: