title: Ansible - Fetch a collection of files to the destination without copying remote host's file structure?
body: <p>I have a playbook doing the following to copy all txt files from a remote host directory to my source dir.</p>
  
  <pre><code>- name: Find files to copy
  find: paths="/tmp/foo" recurse=no patterns="*.txt"
  register: files_to_copy
  - name: Copy files
  fetch: src={{ item.path }} dest=/tmp/foo_files
  with_items: "{{ files_to_copy.files }}"
  </code></pre>
  
  <p>If 2 remote hosts (for example domainA.com and domainB.com) have foo.txt and bar.txt in their separate respective tmp/foo directories, I would like the end result on the host directory to be:</p>
  
  <blockquote>
    <p>/tmp/foo_files/ </p>
    
    <p>foo.txt</p>
    
    <p>bar.txt</p>
  </blockquote>
  
  <p>What I get instead from running above is that the host directory contains:</p>
  
  <blockquote>
    <p>/tmp/foo_files/domainA.com/tmp/foo/foo.txt</p>
    
    <p>/tmp/foo_files/domainB.com/tmp/foo/bar.txt</p>
  </blockquote>