title: Ansible SSH forwarding doesn't seem to work with Vagrant
body: <p>OK, strange question. I have SSH forwarding working with Vagrant. But I'm trying to get it working when using Ansible as a Vagrant provisioner.</p>
  
  <p>I found out exactly what Ansible is executing, and tried it myself from the command line, sure enough, it fails there too. </p>
  
  <pre><code>[/common/picsolve-ansible/u12.04%]ssh -o HostName=127.0.0.1 \
   -o User=vagrant -o  Port=2222 -o UserKnownHostsFile=/dev/null \
   -o StrictHostKeyChecking=no -o PasswordAuthentication=no \
   -o IdentityFile=/Users/bryanhunt/.vagrant.d/insecure_private_key \
   -o IdentitiesOnly=yes -o LogLevel=FATAL \
   -o ForwardAgent=yes "/bin/sh  \
   -c 'git clone git@bitbucket.org:bryan_picsolve/poc_docker.git /home/vagrant/poc_docker' "
  Permission denied (publickey,password).
  </code></pre>
  
  <p>But when I just run vagrant ssh the agent forwarding works correctly, and I can checkout R/W my github project. </p>
  
  <pre><code>[/common/picsolve-ansible/u12.04%]vagrant ssh
  vagrant@vagrant-ubuntu-precise-64:~$ /bin/sh  -c 'git clone git@bitbucket.org:bryan_picsolve/poc_docker.git /home/vagrant/poc_docker'
  Cloning into '/home/vagrant/poc_docker'...
  remote: Counting objects: 18, done.
  remote: Compressing objects: 100% (14/14), done.
  remote: Total 18 (delta 4), reused 0 (delta 0)
  Receiving objects: 100% (18/18), done.
  Resolving deltas: 100% (4/4), done.
  vagrant@vagrant-ubuntu-precise-64:~$
  </code></pre>
  
  <p>Has anyone got any idea how it is working?</p>
  
  <p>Update:</p>
  
  <p>By means of <code>ps awux</code> I determined the exact command being executed by Vagrant.</p>
  
  <p>I replicated it and git checkout worked.</p>
  
  <pre><code> ssh vagrant@127.0.0.1 -p 2222 \
    -o Compression=yes \
    -o StrictHostKeyChecking=no \
    -o LogLevel=FATAL \ 
    -o StrictHostKeyChecking=no \
    -o UserKnownHostsFile=/dev/null \
    -o IdentitiesOnly=yes \
    -i /Users/bryanhunt/.vagrant.d/insecure_private_key \
    -o ForwardAgent=yes \
    -o LogLevel=DEBUG \
     "/bin/sh  -c 'git clone git@bitbucket.org:bryan_picsolve/poc_docker.git /home/vagrant/poc_docker' "
  </code></pre>