title: Ansible: Copy multiple files from multiple sources to multiple destinations in single command
body: <p>I am trying to copy some configuration files from /tmp to /opt. 
  Here first I am recursively searching for the files in /tmp and /opt directories and storing it in the variable tmp_file_path and code_file_path respectively, which has an attribute files.path that I need to use in the source and destination for copy</p>
  
  <pre><code>- name: Find files in tmp
    find:
      paths: /tmp/
      file_type: file
      recurse: yes
      patterns:
        - file1
        - file2
        - file3
    register: tmp_file_path
  - debug:
      var: tmp_file_path
  
  - name: Find files in code
    find:
      paths: /opt/
      file_type: file
      recurse: yes
      patterns: 
        - file1
        - file2
        - file3
    register: code_file_path
  - debug:
      var: code_file_path
  </code></pre>
  
  <p>Here the source file paths can be /tmp/folder1/file1, /tmp/folder2/file2, /tmp/folder13/file3.
  Destinations can be /opt/folderA/file1, /opt/folderB/file3, /opt/folderC/file3</p>
  
  <p>As of now I have managed to write the task as below</p>
  
  <pre><code>- name: Copy files from tmp to code directory
    copy:
      src: "{{item.path}}"
      dest: "{{item.path}}"
      remote_src: yes
    with_items:
      - { "{{ tmp_file_path.files }}", "{{ code_file_path.files }}" }
  </code></pre>
  
  <p>The copy has to be done in a single command so that I do not end up hardcoding the paths for source and destination. Can anyone help me with achieving this?</p>
  
  <p>Below piece of code worked for recursively copying files from code_file_path to /tmp</p>
  
  <pre><code>- name: Copy files from code directory to tmp
    copy:
      src: "{{item.path}}"
      dest: /tmp/
      remote_src: yes
    with_items: "{{code_file_path.files}}"
  </code></pre>