UNREACHABLE! => {“changed”: false, “msg”: “Failed to connect to the host via ssh: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).\r\n”, “unreachable”: true}
I have added the key, even though its say ssh fail to connect.
when you run the playbook through jenkins, it run as jenkins user, did you add the ssh key under the jenkins’s user (/var/lib/jenkins/.ssh/) authorize key and also mentioned the user that you want to connect to remote server over ssh.
turn on debug on the ssh daemon on the target host and see why it’s complaining. perms maybe on the home dir or .ssh dir of the user you are
attempting to run the playbook as?
Password less has been enabled, even though its failed because of permission denied, so after adding key ansible_user value username on extra variables, now its fixed.