ansible_facts["user_dir"] holds unexpected literal as value #10

Closed
opened 2026-05-28 11:24:32 +00:00 by admin · 3 comments
Owner

I believed that the string value held by ansible_facts["user_dir"] would be equivalent to the home directory path of the user Ansible used to log in to the remote host / managed node via SSH (e.g., ansible_user) based on the ran playbook. Turns out this is not the case, just as it is not the case that ansible_user and ansible_facts["user_id"] are equal in string value when running an Ansible playbook.

I may have to replace all instances of ansible_facts["user_dir"] in the code base that intended to refer to the Ansible playbook SSH user's home directory with some other variable, variable and string literal concatenation, or mere string literal.

I believed that the string value held by `ansible_facts["user_dir"]` would be equivalent to the home directory path of the user Ansible used to log in to the remote host / managed node via SSH (e.g., `ansible_user`) based on the ran playbook. Turns out this is not the case, just as it is not the case that `ansible_user` and `ansible_facts["user_id"]` are equal in string value when running an Ansible playbook. I may have to replace all instances of `ansible_facts["user_dir"]` in the code base that intended to refer to the Ansible playbook SSH user's home directory with some other variable, variable and string literal concatenation, or mere string literal.
admin added the fix/semantic_error label 2026-05-28 11:24:32 +00:00
admin self-assigned this 2026-05-28 11:24:32 +00:00
admin added this to the SUKAATO debugging project 2026-05-28 11:24:32 +00:00
admin added this to the debug bootstrapping of armitage milestone 2026-05-28 11:28:11 +00:00
Author
Owner

Given the Ansible playbook was run in check mode, it may be some unique or irregular behavior due to the check mode context. This is a reasonable hypotheses given that, in another case, the group module under check mode does not actually make any changes and thus any following user module that tries to reference a group meant to be created by a group module task may fail. This in spite of check mode reporting it as a successful change--it is successful only so far as the atomic simulation of the task. This means there may be problems with value passing across tasks, especially when some modules may even lack support in check mode.

Rather than use check mode for validation, its best to use staging instead.

Given the Ansible playbook was run in check mode, it may be some unique or irregular behavior due to the check mode context. This is a reasonable hypotheses given that, in another case, the group module under check mode does not actually make any changes and thus any following user module that tries to reference a group meant to be created by a group module task may fail. This in spite of check mode reporting it as a successful change--it is successful only so far as the atomic simulation of the task. This means there may be problems with value passing across tasks, especially when some modules may even lack support in check mode. Rather than use `check mode` for validation, its best to use staging instead.
Author
Owner

For staging, use either a virtual machine (using Vagrant or virt-manager?) or a container.

For staging, use either a virtual machine (using Vagrant or virt-manager?) or a container.
Author
Owner

A Debian 13 based headless virtual machine with SSH service has been spun up using virt-manager.

A Debian 13 based headless virtual machine with SSH service has been spun up using `virt-manager`.
admin closed this issue 2026-05-29 17:21:16 +00:00
admin modified the project from SUKAATO debugging to skato-ansible debugging 2026-05-29 18:10:26 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: admin/skato-ansible#10