title: Ansible : how to rename a file when copying it
body: <p>I have a task , where should I <strong>copy</strong> a file from its source , to its destination <strong>while renaming it in the destination</strong> .</p>
  
  <p>My task looks like this :</p>
  
  <pre><code>- name: Go to the target folder
    shell: ls
    args:
     chdir: "{{pathTest}}/target"
    register: resultLS
  - debug:
     msg: "{{resultLS}}"
  - name: copy jar file
    copy:
     src: "{{resultLS.stdout}}"
     dest: "{{pathTest}}"
     mode: 0777
  </code></pre>
  
  <p>But, like this it copies the jar file with its same name , <strong>my purpose is how to rename it in the <code>dest</code> (ideally with the copy action)</strong></p>
  
  <p><strong>Ideas ?</strong></p>