Ansible failing to copy module to target host

4,947 views
Skip to first unread message

Marko Lisica

unread,
Mar 26, 2014, 8:39:35 AM3/26/14
to ansible...@googlegroups.com
Hi,

I've ran to a problem provisioning one host.

I have playbook that successfully provisions vagrant box, but running that on amazon host I get this

PUT /tmp/tmpxFGcNu TO /tmp/ansible/ansible-tmp-1395837087.32-71225947296118/setup
ec2-xx-xx-xx-xx.compute-1.amazonaws.com | FAILED => failed to transfer file to /tmp/ansible/ansible-tmp-1395837087.32-71225947296118/setup:
 
Couldn't read packet: Connection reset by peer

When I check out tmp dir on remote host I see directiories are created by ansible but no file inside.

Here is complete output:


ansible all -i provision/staging -m setup --private-key=staging-micro.cer -vvvvvv
<ec2-xx-xx-xx-xx.compute-1.amazonaws.com> ESTABLISH CONNECTION FOR USER: admin
<ec2-xx-xx-xx-xx.compute-1.amazonaws.com> REMOTE_MODULE setup
<ec2-xx-xx-xx-xx.compute-1.amazonaws.com> EXEC ['ssh', '-C', '-tt', '-vvv', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/home/marko/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'Port=22', '-o', 'IdentityFile=staging-micro.cer', '-o', 'KbdInteractiveAuthentication=no', '-o', 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey', '-o', 'PasswordAuthentication=no', '-o', 'User=admin', '-o', 'ConnectTimeout=10', 'ec2-xx-xx-xx-xx.compute-1.amazonaws.com', "/bin/sh -c 'mkdir -p /tmp/ansible/ansible-tmp-1395837087.32-71225947296118 && chmod a+rx /tmp/ansible/ansible-tmp-1395837087.32-71225947296118 && echo /tmp/ansible/ansible-tmp-1395837087.32-71225947296118'"]
<ec2-xx-xx-xx-xx.compute-1.amazonaws.com> PUT /tmp/tmpxFGcNu TO /tmp/ansible/ansible-tmp-1395837087.32-71225947296118/setup
ec2-xx-xx-xx-xx.compute-1.amazonaws.com | FAILED => failed to transfer file to /tmp/ansible/ansible-tmp-1395837087.32-71225947296118/setup:

Couldn't read packet: Connection reset by peer

Marko Lisica

unread,
Mar 26, 2014, 9:45:11 AM3/26/14
to ansible...@googlegroups.com
Let me add few more thins and answer to my question.

I have run this on three machines.

Ubuntu 13.04 - Ansible 1.5.3 error was:


PUT /tmp/tmpxFGcNu TO /tmp/ansible/ansible-tmp-1395837087.32-71225947296118/setup
ec2-xx-xx-xx-xx.compute-1.amazonaws.com | FAILED => failed to transfer file to /tmp/ansible/ansible-tmp-
1395837087.32-71225947296118/setup:
 
Couldn't read packet: Connection reset by peer

Mac OSX - Ansible 1.4.4:

| FAILED => failed to transfer file to /home/admin/.ansible/tmp/ansible-1395838813.75-19289519445016/setup:

ControlPath "/Users/marko/.ansible/cp/ansible-ssh-ec2-54-236-227-155.compute-1.amazonaws.com-22-admin.MEUoiLFZkgoecYzU" too long for Unix domain socket
subsystem request failed on channel
0
Connection closed
 

And Debian 7.1 - Ansible 1.6:


failed to open a SFTP connection (Channel closed.)

I have enable scp_if_ssh = True
 and all went well.

Is it only version issue woth dofferent error messages?

Zaven

unread,
Jun 11, 2014, 4:10:55 PM6/11/14
to ansible...@googlegroups.com
We have been experiencing this bug consistently for some time. Is there a ticket to track this, Ansiblers?

fatal: [ec2-54-xxx-yyy-zz.us-west-2.compute.amazonaws.com] => failed to transfer file to /home/ubuntu/.ansible/tmp/ansible-tmp-1402514262.96-23740295147290/source:

Warning: Permanently added 'ec2-54-xxx-yyy-zz.us-west-2.compute.amazonaws.com,54.xxx.yyy.zz' (RSA) to the list of known hosts.
ControlPath "/Users/zaven/.ansible/cp/ansible-ssh-ec2-54-xxx-yyy-xx.us-west-2.compute.amazonaws.com-22-ubuntu.pIvKZuLKKh2LEqwd" too long for Unix domain socket
Write failed: Broken pipe
Connection closed

Michael DeHaan

unread,
Jun 11, 2014, 8:01:02 PM6/11/14
to ansible...@googlegroups.com
It's not a bug so much as a setting you need to change in ansible.cfg because there's very little we can do about it.




--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/19f540a8-68f1-48fa-bfec-bacd96cd9e72%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

John Ross Tasipit

unread,
Aug 27, 2014, 2:02:59 AM8/27/14
to ansible...@googlegroups.com
It could be the sftp config line on the host's /etc/ssh/sshd_config:

Subsystem sftp /usr/libexec/openssh/sftp-server #the path may be different depends on your OS

A Potek

unread,
Jan 15, 2015, 4:37:08 PM1/15/15
to ansible...@googlegroups.com
This problem can exist even in cases where the control-path is reconfigured to be shorter. I made that change in my configuration and it did nothing to resolve the issue.

<##.#.#.#> ESTABLISH CONNECTION FOR USER: [username]
<##.#.#.#> REMOTE_MODULE setup
<##.#.#.#> EXEC ['ssh', '-C', '-tt', '-vvv', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/home/[username]/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'KbdInteractiveAuthentication=no', '-o', 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey', '-o', 'PasswordAuthentication=no', '-o', 'ConnectTimeout=10', '##.#.#.#', "/bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1421357644.16-197958593810564 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1421357644.16-197958593810564 && echo $HOME/.ansible/tmp/ansible-tmp-1421357644.16-197958593810564'"]
<##.#.#.#> PUT /tmp/tmpXLEUtz TO /home/[username]/.ansible/tmp/ansible-tmp-1421357644.16-197958593810564/setup



fatal: [##.#.#.#] => failed to transfer file to /home/USER/.ansible/tmp/ansible-tmp-1421357538.57-18056896264178/setup:


Received message too long 1919246692



As you can see, the number of characters is actually nowhere near the amount needed to trigger that error on my systems, and yet, that's the error that is reported back.

I think something else is actually going on behind the scenes and the error reported back by ansible is making an assumption about the cause of the failure.

In addition, my /etc/ssh/sshd_config is correct for my OS and the path to sftp-server is correct.

A Potek

unread,
Jan 16, 2015, 12:02:33 PM1/16/15
to ansible...@googlegroups.com
Pls ignore. My issue is unrelated and seems to be caused by an "unclean" ssh connection where a .bashrc resource or something similar is echoing something back during the login and causing the content length to be corrupted.

Shaun Barker

unread,
Mar 4, 2016, 5:59:05 AM3/4/16
to Ansible Project
The only thing that worked for me was from something I found on Stackoverflow:

My version of it here:

sudo pip install ansible //dont need this if you have it installed of course - I didnt as was using my git clone.

cd /etc/paths.d/

sudo touch ControlPath

sudo echo export ANSIBLE_SSH_CONTROL_PATH='%(directory)s/%%h-%%r' >> ControlPath

source ControlPath
Reply all
Reply to author
Forward
0 new messages