ansible all -m yum -a "name=java-openjdk state=present install_root=/opt/"

I am getting following error | UNREACHABLE! => { "changed": false, "msg": "Failed to connect to the host via ssh: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).", "unreachable": true }

I can run a playbook like below ansible-playbook --connection=local --inventory, teamcity.yml

1 Answer 1


In your first example you are using whatever connection is specified in your inventory. The second example you specify "connection=local".

Without seeing your inventory and playbook I can't be sure what the best solution is. You could make sure the entry in your hosts file uses the local connection:

 examplehost ansible_connection=local

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .