Ansible playbook failed to connect to the host...permission denied (publickey, password) unreachable

Viewed 2793

Hi guys i'm finding it difficult to run a simple play book. I already ping target and it was successful. When i run the playbook i get this error:

PLAY [install httpd and start services] ***********************************

TASK [Gathering Facts] **************************************************** fatal:[192.168.112.66]: UNREACHABLE!=> {"changed": false "msg": "Failed to connect to the host via ssh: jay@192.168.112.66: Permission denied (publickey password)." "unreachable": true}

Please what's the problem with this?

1 Answers

The remote server is denying you the access due your key has a password. Try this before run the playbook:

$ eval `ssh-agent`
$ ssh-add /path/to/your/private/key

Then run the playbook with the options -u and --private-key pointing to the user with access permissions on remote server and the private key you use.

Related