spurin / diveintoansible-lab

Dive Into Ansible Lab
788 stars 498 forks source link

SSH key issue #35

Closed KarthickSudhakar closed 3 years ago

KarthickSudhakar commented 3 years ago

I am having an SSH key issue with the setup. For some days after the Initial setup I had no issues with the lab but lately, I started getting Key related issues. Last time I cleaned up the keys and created a new key and distributed it across all the nodes. Then it went fine for few days again I am getting the same key error.

Any workaround for this issue?

========================================== Warning: the ECDSA host key for 'ubuntu1' differs from the key for the IP address '172.18.0.8' Offending key for IP in /home/ansible/.ssh/known_hosts:12 Matching host key in /home/ansible/.ssh/known_hosts:1 Warning: the ECDSA host key for 'ubuntu2' differs from the key for the IP address '172.18.0.9' Offending key for IP in /home/ansible/.ssh/known_hosts:8 Matching host key in /home/ansible/.ssh/known_hosts:3 Warning: the ECDSA host key for 'centos1' differs from the key for the IP address '172.18.0.5' Offending key for IP in /home/ansible/.ssh/known_hosts:6 Matching host key in /home/ansible/.ssh/known_hosts:7 Warning: the ECDSA host key for 'centos2' differs from the key for the IP address '172.18.0.3' Offending key for IP in /home/ansible/.ssh/known_hosts:2 Matching host key in /home/ansible/.ssh/known_hosts:9 Are you sure you want to continue connecting (yes/no)? ubuntu3 | SUCCESS => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python3"},"changed": false,"ping": "pong"} Warning: the ECDSA host key for 'centos3' differs from the key for the IP address '172.18.0.4' Offending key for IP in /home/ansible/.ssh/known_hosts:4 Matching host key in /home/ansible/.ssh/known_hosts:11 Are you sure you want to continue connecting (yes/no)?

spurin commented 3 years ago

Hi @KarthickSudhakar

Apologies for the late response on this one. I think that whats happened here, the lab instances have been rebuilt and the identities of the hosts have changed. Easiest thing will be to just nuke the known_hosts file with -

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

And then, re-run the command for it to repopulate fresh identities. Closing the issue for now but please feel free to re-open if it's not clear or is still ongoing.

Best Regards

James Spurin