Simple Ansible ping failing

Environments:

  • 2 VMs (one VirtualBox with CentOS 7 and one Fusion with Fedora 20)
    -Python 2.7.5
    -Ansible 1.6.6 installed via PIP
    -host file with IP of other VM
    -ssh works fine in both directions
    -sftp on both vms
    -sudo user on both vms
    -ssh-key-gen on centos 7 vm and copied to fedora vm in authorized_keys (tested ssh w/o password and it works)

The following command works:
ansible all -m ping -vvvv -c local

The following command fails:
ansible all -m ping -vvvv

— Begin output ----

192.168.1.233> ESTABLISH CONNECTION FOR USER: cjones
<192.168.1.233> REMOTE_MODULE ping
<192.168.1.233> EXEC [‘ssh’, ‘-C’, ‘-tt’, ‘-vvv’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/home/cjones/.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’, ‘192.168.1.233’, “/bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1405139922.21-267195074145055 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1405139922.21-267195074145055 && echo $HOME/.ansible/tmp/ansible-tmp-1405139922.21-267195074145055’”]
<192.168.1.233> PUT /tmp/tmpa1DdNK TO /home/cjones/.ansible/tmp/ansible-tmp-1405139922.21-267195074145055/ping
192.168.1.233 | FAILED => failed to transfer file to /home/cjones/.ansible/tmp/ansible-tmp-1405139922.21-267195074145055/ping:

Received message too long 1097295214

---- End output ----

Suggestions? What gives? This is taking way too long to evaluate :frowning:

Try running with -vvvv if you are using the OpenSSH (-c ssh, or the default on mostly all but CentOS/RHEL control machines) and it will provide some expanded detail for starters.

Seems to be a permissions problem on your homedir though.

I did use -vvvv and I posted the output from it.

I have looked at the docs and found them to be a little sparse on details but good at high-level concepts. They seem to leave out specific details with VERY specific how-tos to make sure simple things do not impede progress (not being critical - simply frustrated).

I also tried -c ssh and -c paramiko with no luck.

If there is a permission’s issue then what would be the suggested fix and where in the docs does it show a DETAILED example?

thx

Follow on…
Should an ssh key put on the controller host from each node host OR just each node host from the controller host?

thx

The way ssh with keys works is that the machine you want to logon FROM has
to have a private key, hosts you want to log TO have to have the public
version of that key.

to test that it is working just use the ssh command itself, if that works,
ansible should work also.

Thanks. As I stated in the opening post, the password-less ssh is working from the controller to the node as expected so I would expect ansible to work.

I also included the output from -vvvv which shows ansible is trying to work but ALWAYS returns ‘FAILED => failed to transfer file to /home/cjones/.ansible/tmp/…/(whatever module I try): Received message too long …’

These are two virgin VMs setup with yum updates, ansible installed via pip, python 2.7.5, centos 7 (controller) and fedora 20 (node) [note: started the other way but had the same issues so we thought we would try making centos 7 the controller and fedora the node]. Maybe we kill fedora all together but I thought it would work with fedora.

Ansible is currently on both VMs but I understand it does not have to be (see previous paragraph note on why it is installed on both).

Also, when I look at the .ansible/tmp/… on the node machine the tmp directories exist from each command I run but nothing is in any directory.

I’m at a lost!!!

thanks

Typically this is caused by having something in your .bashrc or similar that is echoing text. See http://www.snailbook.com/faq/sftp-corruption.auto.html

Matt THANKS!

I thought it was Fedora as a node that was causing an issue but your suggest was spot on! I had a SSH_AGENT script in the .bashrc file so I removed it and it worked.

Thanks

If that’s all you are getting from -vvvv this implies you are using paramiko (Enterprise Linux default), and not openssh. Try it with an explicit -c ssh and let’s see if you get more detail. You won’t want to run this normally but may provide more detail.

I am aware that this is 5 years old but I had a similar problem that was caused by my ~/.ssh/config file. This post is what helped me find my solution.

If anyone else is having this issue, add
ssh_args = -F /dev/null
to your /etc/ansible/ansible.cf