# Copying a directory from one remote host to another

**URL:** <https://forum.ansible.com/t/copying-a-directory-from-one-remote-host-to-another/12472>\
**Category:** Ansible Project\
**Created:** [March 8, 2013, 11:08pm UTC](https://forum.ansible.com/t/copying-a-directory-from-one-remote-host-to-another/12472 "2013-03-08T23:08:15Z")\
**Posts on this page:** 4\
**Page:** 2

<div class="post-metadata">

**Author:** ![Jim\_Kleckner](https://avatars.discourse-cdn.com/v4/letter/j/848f3c/32.png) [@Jim\_Kleckner](https://forum.ansible.com/u/Jim_Kleckner)\
**Post date:** [March 13, 2013, 2:51pm UTC](https://forum.ansible.com/t/copying-a-directory-from-one-remote-host-to-another/12472/21 "2013-03-13T14:51:44Z")

</div>

I prefer that as well.

I have seen some people shy away and am curious why.

Also, some people have situations where they are “fitting in” to  
an existing setup where they just have passwords.

---

<div class="post-metadata">

**Author:** ![Tin\_Tvrtkovic](https://avatars.discourse-cdn.com/v4/letter/t/bc8723/32.png) [@Tin\_Tvrtkovic](https://forum.ansible.com/u/Tin_Tvrtkovic)\
**Post date:** [March 14, 2013, 8:48am UTC](https://forum.ansible.com/t/copying-a-directory-from-one-remote-host-to-another/12472/22 "2013-03-14T08:48:31Z")

</div>

In this case, the automated setting up of keys between two remote machines (and tearing the setup down after, reliably) strikes me as too complex. Since we’ll be using Ansible for automated integration testing (which might include fresh, virgin VM snapshots), we’d really like things to be as automated as possible. SSH agent forwarding looks great (wasn’t familiar with it until the poster above mentioned it), but as far as I can see it requires both key auth and using ssh-agent (and some additional configuration), which I can’t necessarily impose on either our integration test setup nor on the guy who’ll eventually be executing the deployment playbooks on client premises.

I realize passwords are less secure and more cumbersome to use, but they simply fit our current requirements better. Yes, there are things we could do to transition away from using passwords (and maybe we’ll do them in the future), but right now, passwords work for us.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [March 14, 2013, 1:45pm UTC](https://forum.ansible.com/t/copying-a-directory-from-one-remote-host-to-another/12472/23 "2013-03-14T13:45:40Z")

</div>

Solution is to not tear those keys down 🙂

ssh-copy-id is a pretty useful program, though it's even better to  
deploy them at provisioning time, which also all cloud solutions make  
/super/ easy to inject keys.

---

<div class="post-metadata">

**Author:** ![Tin\_Tvrtkovic](https://avatars.discourse-cdn.com/v4/letter/t/bc8723/32.png) [@Tin\_Tvrtkovic](https://forum.ansible.com/u/Tin_Tvrtkovic)\
**Post date:** [March 14, 2013, 2:08pm UTC](https://forum.ansible.com/t/copying-a-directory-from-one-remote-host-to-another/12472/24 "2013-03-14T14:08:52Z")

</div>

I see your point; just as now we have VM images with a preset password we could have VM images that trust a particular key, or deploy a particular key using the password as the first step. We just down atm, due to lack of resources/education/whatever.

As for tearing down keys, if we’re talking about ansible → hosts communication, sure, I’d be fine with leaving the hosts trusting a particular key. If we’re talking remote machine → remote machine (i.e. Postgres slave → Postgres master), I’d really like those two machines to not have a passwordless SSH connection between them outside of the short deployment time.

[Previous page](https://forum.ansible.com/t/copying-a-directory-from-one-remote-host-to-another/12472.md?page=1)
