title: Ansible: clone just one file from git repo
body: <p>Is there any possibility to clone just a <strong>file from git</strong> with <strong>git ansible module</strong>? As I read looks like the git archive from ansible is working only from local cloned repo.</p>
  
  <p>For the moment I use this:</p>
  
  <pre><code>  - name: Bring file from git
       shell:  git archive --remote=git://git.example.com/project.git HEAD:{{ test }} filename | tar -x -C folder1 -s /filename/filename_{{ test }}/
       delegate_to: localhost
  </code></pre>
  
  <p><code>test</code> variable is define in <code>inventory</code> file under each group with other value:</p>
  
  <pre><code>[group1:vars]
  test=abc
  
  [group1]
  host1
  host2
  
  [group2:vars]
  test=xyz
  
  [group2]
  host5
  host6
  </code></pre>
  
  <p>Is there any possibility to make the shell module to be idempotent in order that if the file was already downloaded and exist to not run again same task for the same value of <strong>test</strong> variable over the hosts from the same hostgroup.</p>
  
  <p>As example:</p>
  
  <p>If I run the task from above for group1, the task will run over the first host under the group 1 and will bring the file from git, then will go over second host under group1 and will again bring the same file from git. </p>
  
  <p>What I want to do is that if the task brings the file from git for first host under the group1 to not bring again the same file from git for host2 from group1. </p>
  
  <p>Thanks</p>