When running a playbook, I get "Couldn't read packet: Connection reset by peer" error.

When running a playbook, I get “Couldn’t read packet: Connection reset by peer” error.

For playbook, command, and -vvvv output see: http://pastebin.com/VgAuvrct

Ansible works fine on host1, but I get the error on host2.

If I just use ssh on the command line, both hosts work fine.

I’ve triple checked firewall, ssh_config, sshd_config, /tmp permissions, the users authorized_keys file perms, .ssh dir perms, ssh version, and even the network configuration. Both servers are configured exactly the same.

The remote hosts are running OES11 SP1.

My local desktop is Ubuntu 14.04.

I just pulled the devel branch of Ansible this morning.

Suggestions?

Can you show /tmp permissions?

Also make sure you are SSH’ing as root and not a different user when doing the SSH check?

/tmp on host1

drwxrwxrwt 45 root root 4096 Sep 12 11:26 tmp

/tmp on host2

drwxrwxrwt 47 root root 12288 Sep 12 12:55 tmp

root is blocked from ssh.

What about permissions on the ansible-tmp directory mentioned above?

You may need to set ANSIBLE_KEEP_REMOTE_FILES=1 in your environment to keep it around.

On host1 (where it works)
drwxr-xr-x 2 remoteuser users 4096 Sep 12 13:21 ansible-tmp-1410553290.83-203438518100770

tmp/ansible-tmp-1410553290.83-203438518100770:
total 164
-rw------- 1 remoteuser users 163033 Sep 12 13:21 setup

On host2 (where it doesn’t work)
drwxr-xr-x 2 remoteuser users 4096 Sep 12 11:26 ansible-tmp-1410546380.19-138456709998536

ll tmp/ansible-tmp-1410546380.19-138456709998536

total 0

Like I saw before, the perms are the same.

I initially thought it could be a misconfigured sftp configuration line in the sshd_config. But the two configs are identical.

Hmm… I did check sudo config in the UI, but I haven’t tried visudo yet. Maybe that’ll show something…

If using the SSH connection (which you are by default) you could consider toggling SFTP/SCP in ansible.cfg and see if that helps.

One more thing to try…

But yeah you say those are the same so that’s weird.

scp_if_ssh=True made it work. Weird, very weird.

Is there any major difference between using sftp vs scp?

Basically none.

Sometimes sftp is disabled.

I offhand can’t remember why we didn’t just scp every time - but I think that may encounter occasional reasons as well, perhaps on odd platforms.

In that case, I’ll just leave it set to use scp.

Thanks for the help! :slight_smile: