Solvedansible SSH works, but ansible throws unreachable error
✔️Accepted Answer
This happende all of a sudden when I upgraded Ansible.
To successfully run I had to:
ansible-playbook --limit grunndata playbook.yml -c paramiko -u deploy
Earlier I have only run
ansible-playbook --limit grunndata playbook.yml
Normal SSH with the following works with no issues:
ssh deploy@grunndata
Something has changed.
What information can I provide to help debug this?
I am running the following:
- Ubuntu 16.04
- Ansible 2.1.0.0 installed via pip
Other Answers:
ansible_password
worked for me too
[testServer]
192.168.33.10
[testServer:vars]
ansible_password=vagrant
I resolved a similar issue on Mac OS X with ansible 2.1.2.0 that may help. Not sure where else to post it. I could ssh to the instance, but running my playbook resulted in:
fatal: [ec2-1-2-3-4.us-west-2.compute.amazonaws.com]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh.", "unreachable": true}
No other error output. But it worked with -c paramiko
appended.
I downgraded to ansible 1.9.4 (pip install ansible==1.9.4
) and now when I run it I get the error:
fatal: [ec2-1-2-3-4.us-west-2.compute.amazonaws.com] => SSH Error: unix_listener: "/Users/myname/.ansible/cp/ansible-ssh-ec2-1-2-3-4.us-west-2.compute.amazonaws.com-22-ubuntu.0o1S2DUmaWg7dLdF" too long for Unix domain socket
So I upgraded back to 2.1.2.0 and I added an ansible.cfg
file to my project directory with this content:
[ssh_connection]
control_path=%(directory)s/%%h-%%r
And the connection worked.
+1
needed to add -c paramiko because one of 5 hosts was failing, and I could ssh into all of them successfully.
ISSUE TYPE
ANSIBLE VERSION
CONFIGURATION
No changes
OS / ENVIRONMENT
OS X El Capitan Version 10.11.3
SUMMARY
I can connect to my Rasberry Pi through ssh through an ethernet cable via "ssh pi@169.254.0.2" but running Ansible with this IP address as a host fails.
I have successfully configured this Rasberry Pi with ansible through wifi (using the wifi IP address), but now trying to use ansible via the direct ethernet connection I get the cryptic error message:
Because I can successfully connect to this pi using that IP address through ssh from terminal, I am positing that this is a bug in Ansible.
STEPS TO REPRODUCE
I run this command to rune the role
I also tried
which lead to the same error.
hosts file
playbook
I assume that the role is actually unimportant because ansible is failing at the ssh connection step.
EXPECTED RESULTS
I expect ansible to connect to pi and run the role (I have successfully done this via connecting over an IP address through wifi)
ACTUAL RESULTS