title: Ansible git clone 'Permission Denied' but direct git clone working
body: <p>I got a troubling issue with Ansible. I setup a git cloning on my environment using ssh key of my current host:</p>
  
  <pre><code>- name: Add user Public Key
      copy: 
       src: "/Users/alexgrs/.ssh/id_rsa.pub"
       dest: "/home/vagrant/.ssh/id_rsa.pub"
       mode: 0644
  
  - name: Add user Private Key
      copy: 
       src: "/Users/alexgrs/.ssh/id_rsa"
       dest: "/home/vagrant/.ssh/id_rsa"
       mode: 0600
  
  - name: Clone Repository
    git: 
     repo: repo.git
     dest: /home/vagrant/workspace/
     update: true
     accept_hostkey: true
     key_file: "/home/vagrant/.ssh/id_rsa.pub"
  </code></pre>
  
  <p>If I <code>vagrant ssh</code> on Vagrant and execute <code>git pull repo</code>it works. But when I do a <code>vagrant provision</code> I got the following error message:</p>
  
  <pre><code>stderr: Permission denied (publickey).
  fatal: Could not read from remote repository.
  Please make sure you have the correct access rights and the repository exists.
  </code></pre>
  
  <p>I'm pretty sure my publickey is not used by vangrant provision but I'm not able to detect why.</p>
  
  <p>Did you already see this kind of issue ?</p>
  
  <p>Thank you.</p>
  
  <p><strong>EDIT:</strong>
  It seems that ansible is not doing a git clone but is trying the following command:</p>
  
  <p><code>/usr/bin/git ls-remote ssh://repo.git -h refs/heads/HEAD</code></p>
  
  <p>I tried it in my vagrant box and I have the same permission denied issue.</p>