Ansible Failed Authentication

I am starting out at ansible with a basic playbook to learn ansible I am getting the error message below I know the user and creds are correct I have logged into that switch from
ansible server can someone please let me know what I am missing?

error message

TASK [Gathering Facts] ************************************************************************************************************************************************

fatal: [vegeta01_temp]: UNREACHABLE! => {“changed”: false, “msg”: “Failed to connect to the host via ssh: \n****************************************************************************Permission denied (publickey,password,keyboard-interactive).”, “unreachable”: true}

[...]

please let me know what I am missing?

There might be something else, but these 3 lines look wrong, just one
"}" should be two.

    ssh:
      host: “{{ansible_host}”
      username: “{{vegeta}”
      password: “{{abc123}”

Also can you ssh to that server with the username you define as
variable "{{ vegeta }}".

Wawrzek

ok fixed the username and password and I am still not able to login using the playbook

Also to answer your question yes I am able to login using vegeta with just plain ssh into switch

also here is a copy are my settings of for ansible.cfg and version I am running

ansible 2.7.8

config file = /etc/ansible/ansible.cfg

configured module search path = [‘/usr/share/ansible’]

ansible python module location = /usr/local/lib/python3.6/site-packages/ansible

executable location = /usr/local/bin/ansible

python version = 3.6.8 (default, Feb 22 2019, 12:24:32) [GCC 4.4.7 20120313 (Red Hat 4.4.7-23)]

[root@ansiblevm ansible]#

cat ansible.cfg | grep -v “#”

[defaults]

library = /usr/share/ansible/

remote_tmp = $HOME/.ansible/tmp

forks = 5

timeout = 10

log_path = /var/log/ansible.log

[inventory]

[privilege_escalation]

[paramiko_connection]

[ssh_connection]

[persistent_connection]

[accelerate]

[selinux]

[colors]

[diff]

Please provide the new error message you’re getting. Can you do a simple “ansible ping” (https://docs.ansible.com/ansible/latest/user_guide/intro_getting_started.html#your-first-commands).

Dan

when I do a ansible all -i inventory/inv_sjc_core -u vegeta -m ping -k it does not authenticate but if I do a “ssh -l vegeta vegeta01_temp” it works

vegeta01_temp | UNREACHABLE! => {

“changed”: false,

“msg”: “Authentication or permission failure. In some cases, you may have been able to authenticate and did not have permissions on the target directory. Consider changing the remote tmp path in ansible.cfg to a path rooted in "/tmp". Failed command was: ( umask 77 && mkdir -p "echo Cmd exec error./.ansible/tmp/ansible-tmp-1551117540.2506652-80180766644234" && echo ansible-tmp-1551117540.2506652-80180766644234="echo Cmd exec error./.ansible/tmp/ansible-tmp-1551117540.2506652-80180766644234" ), exited with result 16, stdout output: Syntax error while parsing ‘/bin/sh -c ‘( umask 77 && mkdir -p "echo Cmd exec error./.ansible/tmp/ansible-tmp-1551117540.2506652-80180766644234" && echo ansible-tmp-1551117540.2506652-80180766644234="echo Cmd exec error./.ansible/tmp/ansible-tmp-1551117540.2506652-80180766644234" ) && sleep 0’’\n\n\nCmd exec error.\n”,

“unreachable”: true

}

vegeta02_temp | UNREACHABLE! => {

“changed”: false,

“msg”: “Authentication or permission failure. In some cases, you may have been able to authenticate and did not have permissions on the target directory. Consider changing the remote tmp path in ansible.cfg to a path rooted in "/tmp". Failed command was: ( umask 77 && mkdir -p "echo Cmd exec error./.ansible/tmp/ansible-tmp-1551117540.287293-48560425026336" && echo ansible-tmp-1551117540.287293-48560425026336="echo Cmd exec error./.ansible/tmp/ansible-tmp-1551117540.287293-48560425026336" ), exited with result 16, stdout output: Syntax error while parsing ‘/bin/sh -c ‘( umask 77 && mkdir -p "echo Cmd exec error./.ansible/tmp/ansible-tmp-1551117540.287293-48560425026336" && echo ansible-tmp-1551117540.287293-48560425026336="echo Cmd exec error./.ansible/tmp/ansible-tmp-1551117540.287293-48560425026336" ) && sleep 0’’\n\n\nCmd exec error.\n”,

“unreachable”: true

}

[root@ansiblevm ansible]#

ok fixed my issue I was missing “connection:local” in my playbook thx for your help

before my issue I was missing connection: local now I am able to run and I am getting message below I have doubled checked my username and password below is my .yaml syntax

TASK [show version] ***************************************************************************************************************************************************

fatal: [vegetacore01_temp]: FAILED! => {“msg”: “Invalid/incorrect username/password. Private key file is encrypted”}

fatal: [vegetacore02_temp]: FAILED! => {“msg”: “Invalid/incorrect username/password. Private key file is encrypted”}