spurin / diveintoansible-lab

Dive Into Ansible Lab
776 stars 494 forks source link

unable to reach centos1 #89

Closed dsbc4534 closed 2 years ago

dsbc4534 commented 2 years ago

Hi, Mr. Spurin I was doing the lesson for Inventories when I got this error message:

ansible@ubuntu-c:~/diveintoansible/Ansible Architecture and Design/inventories/01$ ANSIBLE_HOST_KEY_CHECKING=False ansible all -m ping centos1 | UNREACHABLE! => { "changed": false, "msg": "Failed to connect to the host via ssh: Warning: Permanently added 'centos1,172.18.0.9' (ECDSA) to the list of known hosts.\r\nansible@centos1: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).", "unreachable": true }

Did I miss a step along the way?

DavidRBanks commented 2 years ago

Make sure you follow the steps outlined in lesson 6. The generation of the ubuntu-c public key, as well as the installation of sshpass and using the for loop to copy out the public key to each of the ubuntu/centos boxes is covered there. If you skip this and jump directly into the official lessons, you will run into the issue above.

for user in ansible root; do   for os in ubuntu centos;   do     for instance in 1 2 3;     do       sshpass -f password.txt ssh-copy-id -o StrictHostKeyChecking=no ${user}@${os}${instance};     done;   done; done
spurin commented 2 years ago

Thanks @DavidRBanks

dsbc4534 commented 2 years ago

Thank you very much, David. I did not skip the class, but I certainly made a mistake. I went back and found the issue: image I had a double K. a typo that did not push the pub key properly. Awesome work.

dsbc4534 commented 2 years ago

Issue resolved. closing thread.