# I want to copy the remote server file to my local server but I am not able to copy

**URL:** <https://forum.ansible.com/t/i-want-to-copy-the-remote-server-file-to-my-local-server-but-i-am-not-able-to-copy/29336>\
**Category:** Ansible Developer\
**Created:** [December 28, 2018, 9:33am UTC](https://forum.ansible.com/t/i-want-to-copy-the-remote-server-file-to-my-local-server-but-i-am-not-able-to-copy/29336 "2018-12-28T09:33:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sachidanand\_Chaudhar](https://avatars.discourse-cdn.com/v4/letter/s/3ab097/32.png) [@Sachidanand\_Chaudhar](https://forum.ansible.com/u/Sachidanand_Chaudhar)\
**Post date:** [December 28, 2018, 9:33am UTC](https://forum.ansible.com/t/i-want-to-copy-the-remote-server-file-to-my-local-server-but-i-am-not-able-to-copy/29336/1 "2018-12-28T09:33:06Z")

</div>

Hello All,

Following are my details regarding copying from the remote machine, I have to copy the propertie file from the remote test server to the local ansible server.

I have achieved this task using ssh command as below:

sshpass -p jpass scp -o StrictHostKeyChecking=no “testuser@testmachine:/opt/testserver/jetty/jetty-distribution-9.3/etc/core/application.properties” “/opt/jenkins/sharedspace/BackupRestore/resources”

However, my I want this to be converted to ansible copy format like this but somehow I am not able to copy that remote file. (Only thing is one should copy that file as become\_user: root which I am already doing)

- hosts: [testserver.testing.com](http://testserver.testing.com) (This is ansible server host)  
remote\_user: sampleuser
- name: webapps copy  
become: yes  
become\_user: root  
copy:  
src: /opt/testserver/jetty/jetty-distribution-9.3/etc/core/application.properties  
dest: /opt/jenkins/sharedspace/BackupRestore/resources  
owner: testuser  
group: testuser

**Getting a below issue:**

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AnsibleFileNotFound: Could not find or access '/opt/testserver/jetty/9.3/webapps/

Could anyone know on this more?

Thanks in Advanced.

Thanks,  
Sachi

---

<div class="post-metadata">

**Author:** ![ipitythaphool](https://avatars.discourse-cdn.com/v4/letter/i/6de8d8/32.png) [@ipitythaphool](https://forum.ansible.com/u/ipitythaphool)\
**Post date:** [December 28, 2018, 8:31pm UTC](https://forum.ansible.com/t/i-want-to-copy-the-remote-server-file-to-my-local-server-but-i-am-not-able-to-copy/29336/2 "2018-12-28T20:31:39Z")

</div>

You probably want the fetch module  
[https://docs.ansible.com/ansible/latest/modules/fetch\_module.html#fetch-module](https://docs.ansible.com/ansible/latest/modules/fetch_module.html#fetch-module)

Or slurp will load into memory
