Ansible gotcha: Playbook sudo vs task sudo

Categories: ansible

TL;DR;

When running a playbook with sudo: yes, it also runs the facts module with sudo, so ansible_user_dir will have the value of the root user, rather than the expected home directory of the ansible_ssh_user.

Read more...