# Ansible copy module takes lot of time on same machine

**URL:** <https://forum.ansible.com/t/ansible-copy-module-takes-lot-of-time-on-same-machine/16705>\
**Category:** Ansible Project\
**Created:** [November 5, 2014, 9:21pm UTC](https://forum.ansible.com/t/ansible-copy-module-takes-lot-of-time-on-same-machine/16705 "2014-11-05T21:21:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ethan\_Collins](https://avatars.discourse-cdn.com/v4/letter/e/a87d85/32.png) [@Ethan\_Collins](https://forum.ansible.com/u/Ethan_Collins)\
**Post date:** [November 5, 2014, 9:21pm UTC](https://forum.ansible.com/t/ansible-copy-module-takes-lot-of-time-on-same-machine/16705/1 "2014-11-05T21:21:54Z")

</div>

I am using Ansible to copy a file from Debian to XP running on the same machine on Virtualbox. Copying the file (437KB) using ssh as transport is taking 5 secs. I profiled the same copy operation using scp and that takes ~820ms.

I am using ssh 5.5 on Debian squeeze and hence don’t have ControlPersist support. I have set in ansible.cfg: [defaults] … transport = ssh

[ssh\_connection] ssh\_args = -o GSSAPIAuthentication=no -o GSSAPIKeyExchange=no -o AddressFamily=inet -o Ciphers=arcfour,blowfish-cbc scp\_if\_ssh = True

I am using Ansible 1.6.6.

How can I better the speed, close to that of scp? Am I missing some configuration?

---

<div class="post-metadata">

**Author:** ![Ethan\_Collins](https://avatars.discourse-cdn.com/v4/letter/e/a87d85/32.png) [@Ethan\_Collins](https://forum.ansible.com/u/Ethan_Collins)\
**Post date:** [November 6, 2014, 3:41pm UTC](https://forum.ansible.com/t/ansible-copy-module-takes-lot-of-time-on-same-machine/16705/2 "2014-11-06T15:41:00Z")

</div>

Can someone help me in solving this problem? This delay shows up in all things I execute using Ansible, thus making making my projects extremely slow. Tried several options on the net (that’s why you see the ssh\_args customized) but nothing fixed or bettered it.

---

<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 6, 2014, 4:12pm UTC](https://forum.ansible.com/t/ansible-copy-module-takes-lot-of-time-on-same-machine/16705/3 "2014-11-06T16:12:32Z")

</div>

have you tried switching to paramiko as a transport? the default ‘smart’ would use whichever is more optimal for your system.

---

<div class="post-metadata">

**Author:** ![Ethan\_Collins](https://avatars.discourse-cdn.com/v4/letter/e/a87d85/32.png) [@Ethan\_Collins](https://forum.ansible.com/u/Ethan_Collins)\
**Post date:** [November 6, 2014, 4:25pm UTC](https://forum.ansible.com/t/ansible-copy-module-takes-lot-of-time-on-same-machine/16705/4 "2014-11-06T16:25:13Z")

</div>

Yes, I had tried that – it pushes the CPU to max power and takes almost similar time.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [November 7, 2014, 2:21pm UTC](https://forum.ansible.com/t/ansible-copy-module-takes-lot-of-time-on-same-machine/16705/5 "2014-11-07T14:21:03Z")

</div>

You can refer to [http://www.ansible.com/blog/ansible-performance-tuning](http://www.ansible.com/blog/ansible-performance-tuning) for tuning tips.

---

<div class="post-metadata">

**Author:** ![Ethan\_Collins](https://avatars.discourse-cdn.com/v4/letter/e/a87d85/32.png) [@Ethan\_Collins](https://forum.ansible.com/u/Ethan_Collins)\
**Post date:** [November 7, 2014, 5:32pm UTC](https://forum.ansible.com/t/ansible-copy-module-takes-lot-of-time-on-same-machine/16705/6 "2014-11-07T17:32:19Z")

</div>

Hi Michael,

I looked into the link. Note that I don’t have ssh 5.6+ to use ControlPersist feature. Tried with paramiko, but with no change.

#1 In my first query, I had minimized the problem to the copy module. Copy module takes ~5 secs while scp takes \< 1sec. I tried several options, but with no outcome. Can you help me in solving this?

#2 I am on Debian squeeze and hence there is no ssh version \> 5.5. I don’t want to mess with the setup, as I login to my external servers. If I compile ssh 5.6+, can I provide to Ansible the path to the binary?

I look forward to your inputs.
