Fix: Exclude root user from tmux configuration
Modified 'roles/tmux/tasks/main.yml' to ensure that the tmux configuration is not applied to the root user's home directory. This was achieved by adding a condition to exclude the 'root' user when generating the list of user home directories.
This commit is contained in:
@@ -16,7 +16,9 @@
|
|||||||
set_fact:
|
set_fact:
|
||||||
user_home_dirs: "{{ user_home_dirs | default([]) + [item.value[4]] }}"
|
user_home_dirs: "{{ user_home_dirs | default([]) + [item.value[4]] }}"
|
||||||
loop: "{{ all_users.ansible_facts.getent_passwd | dict2items }}"
|
loop: "{{ all_users.ansible_facts.getent_passwd | dict2items }}"
|
||||||
when: item.value[5] in ['/bin/bash', '/bin/zsh', '/usr/bin/bash', '/usr/bin/zsh', '/usr/bin/fish']
|
when:
|
||||||
|
- item.value[5] in ['/bin/bash', '/bin/zsh', '/usr/bin/bash', '/usr/bin/zsh', '/usr/bin/fish']
|
||||||
|
- item.value[0] != 'root'
|
||||||
|
|
||||||
- name: Display the list of collected home directories
|
- name: Display the list of collected home directories
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
|
|||||||
Reference in New Issue
Block a user