spurin / diveintoansible-lab

Dive Into Ansible Lab
788 stars 498 forks source link

all -m ping returns unreachable (Win10) #45

Closed bjoernmichels closed 3 years ago

bjoernmichels commented 3 years ago

Hi, in Chapter 2, when executing ansible@ubuntu-c:/$ ansible -i,ubuntu1,ubuntu2,ubuntu3,centos1,centos2,centos3 all -m ping I receive ubuntu1 | UNREACHABLE! => { "changed": false, "msg": "Failed to connect to the host via ssh: Control socket connect(/home/ansible/.ansible/cp/492fe51149): Connection refused\r\nFailed to connect to new control master", "unreachable": true } for each of the hosts. ssh ubuntu1 works fine. Also for all other hosts. The mentioned folder /home/ansible/.ansible/cp/ is empty. Thanks for your help.

spurin commented 3 years ago

@bjoernmichels

Thanks for raising this one, I'm very grateful that you did.

This is a problem with how Ansible handles connections and is an issue that only seems to affect Docker on certain OS versions. Previously, I had a fix for this in the image container but it looks like they moved some of the code references with the recent move and update to 4.x.

I've just ported the patch for this to the 4.x equivalent and now all should be working as expected. If you ctrl-c your running lab, then -

docker-compose pull

It will download the latest version with this fix. Log back in as ansible and then run the following commands to clear any references to the old host identity -

rm -rf /home/ansible/.ssh/known_hosts
sudo rm -rf /root/.ssh/known_hosts

Then, you should be good. If you could confirm that this works as expected, I'd be very thankful.

Best Regards

James Spurin

bjoernmichels commented 3 years ago

Now ist works fine. Thanks a lot!