I’m running a playbook where remote_user is root, and on some tasks, I use “sudo: yes” with “sudo_user: jenkins” to do some per-user setup. At the moment, I’m trying to clone a git repo. Whether I use the git module or the command module to run “git clone” directly, it keeps failing with:
stderr: fatal: Cannot change to ‘/root/…’: Permission denied
I can work around this by using the command module and adding “chdir=/tmp” to it. I don’t know why this works, but it seems there’s no other way to do it when using remote_user=root, sudo=yes, and sudo_user=. Help?