refactor(tasks): prefix the home directory fact with the role name

`set_fact` writes into the play scope, so `user_user_home` outlived the loop iteration that set it and collided with any
playbook variable of the same name. Worse, if the defining task were ever skipped, every following task would silently
operate on the home directory of the previously processed user.

Renaming it to `_unix_users_home` marks it as role internal and matches the underscore prefix already used by the other
internal facts in this role. Purely mechanical, no behaviour changes.

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
2026-09-09 21:39:42 +02:00
co-authored by Copilot
parent 095705643c
commit 517d9c1c54
3 changed files with 24 additions and 24 deletions
+2 -2
View File
@@ -3,7 +3,7 @@
- name: "Determine shell rc directory"
ansible.builtin.set_fact:
# path_join examples: https://docs.ansible.com/ansible/latest/collections/ansible/builtin/path_join_filter.html#examples
_shell_rc_file: "{{ (user_user_home, '.bashrc.d', shell_rc_file.file) | path_join }}"
_shell_rc_file: "{{ (_unix_users_home, '.bashrc.d', shell_rc_file.file) | path_join }}"
- name: "Create shell rc directory: {{ _shell_rc_file | dirname }}"
ansible.builtin.file:
@@ -23,7 +23,7 @@
- name: "Source shell rc file: {{ _shell_rc_file }}"
ansible.builtin.lineinfile:
path: "{{ user_user_home }}/.bashrc"
path: "{{ _unix_users_home }}/.bashrc"
line: "source \"{{ _shell_rc_file }}\""
owner: "{{ unix_user.key }}"
group: "{{ unix_user.value.group | default('users') }}"