jdfolino
jdfolino

Reputation: 327

Ansible cannot connect to host via specified private key

The following command works from my OSX terminal:

ssh [email protected] -i .vagrant/machines/centos100/virtualbox/private_key

I have an inventory file called "hosts" with the following:

192.168.50.100 ansible_user=vagrant ansible_ssh_private_key_file=.vagrant/machines/centos100/virtualbox/private_key

However when I run the following:

ansible -i hosts all -m ping -v

I get: 192.168.50.100 | FAILED => SSH encountered an unknown error during the connection. We recommend you re-run the command using -vvvv, which will enable SSH debugging output to help diagnose the issue

Upvotes: 0

Views: 484

Answers (1)

jdfolino
jdfolino

Reputation: 327

I was using ansible 1.8.2 where ansible_user is still ansible_ssh_user

The correct hosts file is:

192.168.50.100 ansible_ssh_user=vagrant ansible_ssh_private_key_file=.vagrant/machines/centos100/virtualbox/private_key

Upvotes: 0

Related Questions