failing to connect through ssh

I used the below example to execute from GIT
https://github.com/GoogleCloudPlatform/compute-ansible-gluster

I am getting the following error:

fatal: [35.184.19.164]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\r\n@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @\r\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\r\nIT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!\r\nSomeone could be eavesdropping on you right now (man-in-the-middle attack)!\r\nIt is also possible that a host key has just been changed.\r\nThe fingerprint for the ECDSA key sent by the remote host is\n05:88:4d:7f:50:ec:21:38:12:d9:b8:0f:b1:29:0c:33.\r\nPlease contact your system administrator.\r\nAdd correct host key in /root/.ssh/known_hosts to get rid of this message.\r\nOffending ECDSA key in /root/.ssh/known_hosts:17\r\nChallenge/response authentication is disabled to avoid man-in-the-middle attacks.\r\nPermission denied (publickey,gssapi-keyex,gssapi-with-mic).\r\n", "unreachable": true}
fatal: [35.202.50.199]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\r\n@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @\r\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\r\nIT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!\r\nSomeone could be eavesdropping on you right now (man-in-the-middle attack)!\r\nIt is also possible that a host key has just been changed.\r\nThe fingerprint for the ECDSA key sent by the remote host is\n23:8a:d0:e0:50:be:97:9a:c7:64:c1:24:b1:f2:42:1f.\r\nPlease contact your system administrator.\r\nAdd correct host key in /root/.ssh/known_hosts to get rid of this message.\r\nOffending ECDSA key in /root/.ssh/known_hosts:13\r\nChallenge/response authentication is disabled to avoid man-in-the-middle attacks.\r\nPermission denied (publickey,gssapi-keyex,gssapi-with-mic).\r\n", "unreachable": true}
fatal: [35.193.161.39]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\r\n@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @\r\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\r\nIT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!\r\nSomeone could be eavesdropping on you right now (man-in-the-middle attack)!\r\nIt is also possible that a host key has just been changed.\r\nThe fingerprint for the ECDSA key sent by the remote host is\nc1:65:32:ac:b6:97:a9:ec:55:38:ba:ac:49:1e:5e:6e.\r\nPlease contact your system administrator.\r\nAdd correct host key in /root/.ssh/known_hosts to get rid of this message.\r\nOffending ECDSA key in /root/.ssh/known_hosts:12\r\nChallenge/response authentication is disabled to avoid man-in-the-middle attacks.\r\nPermission denied (publickey,gssapi-keyex,gssapi-with-mic).\r\n", "unreachable": true}
        to retry, use: --limit @/home/gcpconsole/compute-ansible-gluster/gluster.retry

PLAY RECAP ************************************************************************************************************
127.0.0.1                  : ok=7    changed=6    unreachable=0    failed=0   
35.184.19.164              : ok=0    changed=0    unreachable=1    failed=0   
35.193.161.39              : ok=0    changed=0    unreachable=1    failed=0   
35.202.232.100             : ok=0    changed=0    unreachable=1    failed=0   
35.202.50.199              : ok=0    changed=0    unreachable=1    failed=0  

***********************************************************************************************************************************************
I have added all the necessary key in the GCP console....


Please help me soving this

Hi

As the errors state this is a problem with how the SSH keys are set-up.
The github URL has quite elaborate documentation (as usual with Google tools), and it includes a URL to an even more elaborate page specifically for setting up SSH keys (for completeness: https://cloud.google.com/compute/docs/instances/adding-removing-ssh-keys?hl=en).
Check those steps again.

One hint could be that apparently you’re running this playbook as root.
Could it be that you’ve set up SSH keys in a different/your account, but that you are running the playbook with ‘sudo’? That would explain things.
If that’s the case: don’t do that. Run the playbook as the user that you’ve setup SSH keys for.

Dick

Hi Dick

Thanks a lot for your reply Dick… I tied the same steps as you have suggested in the link, still the error is coming and i have also tried running the playbook as user rather than root, but still error is coming.

TASK [Gathering Facts] *****************************************************************************************
fatal: [35.202.234.156]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: Warning: Permanently added '35.202.234.156' (ECDSA) to the list of known hosts.\r\nPermission denied (publickey,gssapi-keyex,gssapi-with-mic).\r\n", "unreachable": true}
fatal: [35.202.50.199]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: Warning: Permanently added '35.202.50.199' (ECDSA) to the list of known hosts.\r\nPermission denied (publickey,gssapi-keyex,gssapi-with-mic).\r\n", "unreachable": true}
fatal: [35.202.232.100]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: Warning: Permanently added '35.202.232.100' (ECDSA) to the list of known hosts.\r\nPermission denied (publickey,gssapi-keyex,gssapi-with-mic).\r\n", "unreachable": true}
fatal: [35.184.19.164]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: Warning: Permanently added '35.184.19.164' (ECDSA) to the list of known hosts.\r\nPermission denied (publickey,gssapi-keyex,gssapi-with-mic).\r\n", "unreachable": true}
 [WARNING]: Could not create retry file '/home/gcpconsole/compute-ansible-gluster/gluster.retry'.
[Errno 13] Permission denied: u'/home/gcpconsole/compute-ansible-gluster/gluster.retry'

PLAY RECAP *****************************************************************************************************
127.0.0.1                  : ok=7    changed=6    unreachable=0    failed=0   
35.184.19.164              : ok=0    changed=0    unreachable=1    failed=0   
35.202.232.100             : ok=0    changed=0    unreachable=1    failed=0   
35.202.234.156             : ok=0    changed=0    unreachable=1    failed=0   
35.202.50.199              : ok=0    changed=0    unreachable=1    failed=0   
:-( 

Thanks in advance
chandana

Hi

Hi Dick

Thanks a lot for your reply Dick..... I tied the same steps as you have suggested in the link, still the error is coming and i have also tried running the playbook as user rather than root, but still error is coming.

Actually, it is a different error, and also a warning (at the end).
To fix one thing at a time - can you make sure the permissions are
fixed, and then run the playbook again?

Dick