title: Ansible task - clone private git without SSH forwarding
body: <p>I am trying to create an Ansible playbook which would be run from our dev team computers and from CI/CD servers.</p>
  
  <p>One of the tasks in the playbook is to get the source code of our project from a private git repository. Because the playbook has to run from CI/CD servers we can not use SSH forwarding.</p>
  
  <p>What i came up with is to copy necessary SSH private key to remote host machine and then using the key clone the code from the private git repository.</p>
  
  <p>However when trying this, the cloning task hangs. When trying to launch the command manually it asks for a passphrase for the SSH private key. SSH key uses no passphrase (blank).</p>
  
  <p><strong>Could anyone share their solution of this (probably very common) problem?</strong></p>
  
  <p>In case anyone needs, this is my current playbook:</p>
  
  <pre><code>- name: Create SSH directory
    file: path=/root/.ssh state=directory
  
  - name: Copy SHH key for Git access
    copy:
      content: "{{ git_ssh_key }}"
      dest: /root/.ssh/id_rsa
      owner: root
      group: root
      mode: 0600
  
  # Also tried this, but it also hangs
  #- name: Start SSH agent and add SSH key
  #  shell: eval `ssh-agent -s` &amp;&amp; ssh-add
  
  - name: Get new source from GIT
    git: 
      key_file: /root/.ssh/id_rsa
      repo: "git@gitlab.com:user/repo.git"
      dest: "{{ staging_dir }}"
      depth: 1
      accept_hostkey: yes
      clone: yes
  </code></pre>
  
  <p>I am using <code>ansible 2.3.1.0, python version = 2.7.12</code></p>