# 'copy' operation on remote host?

**URL:** <https://forum.ansible.com/t/copy-operation-on-remote-host/16830>\
**Category:** Ansible Project\
**Created:** [November 19, 2014, 11:03pm UTC](https://forum.ansible.com/t/copy-operation-on-remote-host/16830 "2014-11-19T23:03:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Oliver](https://avatars.discourse-cdn.com/v4/letter/j/97f17d/32.png) [@John\_Oliver](https://forum.ansible.com/u/John_Oliver)\
**Post date:** [November 19, 2014, 11:03pm UTC](https://forum.ansible.com/t/copy-operation-on-remote-host/16830/1 "2014-11-19T23:03:51Z")

</div>

Is there a way to use the ‘copy’ module, or an equivalent, to copy files from one spot to another on the target host?

Right now, I’m trying to use ‘command’ or ‘shell’, but I’m running into issues with unusable choking on an asterisk, and I have to use several lines to copy, set ownership, set perms, etc.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [November 20, 2014, 12:17am UTC](https://forum.ansible.com/t/copy-operation-on-remote-host/16830/2 "2014-11-20T00:17:47Z")

</div>

not currently, but it sounds like a useful feature.

You can start a discussion in ansible-devel mailing list or open a ticket in github ([http://github.com/ansible/ansible-modules-core](http://github.com/ansible/ansible-modules-core) for the project to implement the feature.

---

<div class="post-metadata">

**Author:** ![Marc\_Patermann](https://avatars.discourse-cdn.com/v4/letter/m/ed655f/32.png) [@Marc\_Patermann](https://forum.ansible.com/u/Marc_Patermann)\
**Post date:** [November 20, 2014, 8:23am UTC](https://forum.ansible.com/t/copy-operation-on-remote-host/16830/3 "2014-11-20T08:23:21Z")

</div>

John Oliver schrieb (20.11.2014 00:03 Uhr):

> Is there a way to use the 'copy' module, or an equivalent, to copy files from one spot to another on the target host?

\>

> Right now, I'm trying to use 'command' or 'shell', but I'm running into issues with unusable choking on an asterisk, and I have to use several lines to copy, set ownership, set perms, etc.

Two shell tasks with "tar -c" and "tar -x"?

Marc

---

<div class="post-metadata">

**Author:** ![Josh\_Smift1](https://avatars.discourse-cdn.com/v4/letter/j/bcef8e/32.png) [@Josh\_Smift1](https://forum.ansible.com/u/Josh_Smift1)\
**Post date:** [November 20, 2014, 12:56pm UTC](https://forum.ansible.com/t/copy-operation-on-remote-host/16830/4 "2014-11-20T12:56:21Z")

</div>

> Two shell tasks with "tar -c" and "tar -x"?

If you want to preserve permissions; or you could run a command that pipes  
one to the other; or you could run a command that runs an rsync preserving  
permissions.

If you want to copy a file and \*change\* the permissions, that could be  
harder. Maybe the 'install' command?

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-Josh (jbs@care.com)

This email is intended for the person(s) to whom it is addressed and may contain information that is PRIVILEGED or CONFIDENTIAL. Any unauthorized use, distribution, copying, or disclosure by any person other than the addressee(s) is strictly prohibited. If you have received this email in error, please notify the sender immediately by return email and delete the message and any attachments from your system.
