Jump to content

ansible automation : unable to automate setting up ssh keys on hosts


Recommended Posts


I have been trying to automate the setting up od ssh keys on host machines using ansible. I have setup a master and test machine using vagrant on centos7. It automatically creates the vagrant user on both machines with sudo rights. Now I do not wish to manually copy the public key from the master to the node machine. I would rather have ansible do it. It always gives the following error:


TASK [Gathering Facts] ***************************************************************************************************************
fatal: [web01]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).\r\n", "unreachable": true}
        to retry, use: --limit @/vagrant/playbook.retry

    My sshd_config has PasswordAuthentication = yes. Yet it does not ask for the password.

If I try and ssh into the server directly from the terminal i get the following error :


Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

 and again it does not ask for the password.

Looking for any suggestion and stuff I can try. 

Thanks all !




Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.