So I've seen this question and added the Defaults env_keep+=SSH_AUTH_SOCK
into my /etc/sudoers
file but I am still unable to clone from github on my Vagrant box using sudo: true
and sudo_user: <user>
in my ansible playbook. I'd like to clone the code as the user I created to run it but it is proving to be really frustrating. I can do ssh git@github.com
when I log in via vagrant ssh
but when I then do sudo -u <user> ssh git@github.com
I get the Permission Denied error. When I echo the SSH_AUTH_SOCK
value as the specific user I see that it is set:
vagrant@vagrant-ubuntu-trusty-64:/tmp$ sudo -u derp echo $SSH_AUTH_SOCK
/tmp/ssh-w3XYbqlMnX/agent.1592