ansible-for-devops icon indicating copy to clipboard operation
ansible-for-devops copied to clipboard

Running your first Ad-Hoc Ansible command - missing ssh key or password

Open dnsbob opened this issue 4 years ago • 4 comments

Trying to follow "Running your first Ad-Hoc Ansible command" gets an error because you have not given a password or set up an ssh key to the remote host.

dnsbob avatar Aug 06 '20 01:08 dnsbob

Reading on, I see that you talk about this at length. But only AFTER the error has occurred, and users like me have gone back, reread the section, double-checked our work, and filed a bug report. Please, a heads up ahead of time would have saved a lot of wasted time and effort.

dnsbob avatar Aug 06 '20 01:08 dnsbob

Reading on, I see that you talk about this at length. But only AFTER the error has occurred, and users like me have gone back, reread the section, double-checked our work, and filed a bug report. Please, a heads up ahead of time would have saved a lot of wasted time and effort.

Dude, yea. I just spent an hour and half trying to figure this one out

rpappalax avatar Sep 11 '20 03:09 rpappalax

I don't see a problem in the "Running your first Ad-Hoc Ansible Command". There is no need to provide password or setup SSH Key BECAUSE of the private-key SSH authentication of vagrant user.

ansible_ssh_private_key_file: ~/.vagrant.d/insecure_private_key

The above line placed in the inventory should not prompt for password.

If you still see issues, please paste the error here.

abidmunirmalik avatar Sep 23 '20 12:09 abidmunirmalik

This was probably my biggest lesson in the last 5 years. It took me 7 straight hours for me to figure out that it was an ssh issue.

If it's the issue I went through, the machine cannot ssh into itself. Add the private key into your .ssh directory, and rename it "id_rsa"

typ-ex avatar Mar 06 '21 14:03 typ-ex