Ansible win_ping fails

24 views
Skip to first unread message

Scott V

unread,
Jan 27, 2020, 3:25:01 PM1/27/20
to Ansible Project
I have OpenSSH configured on a Windows 2012 server and I can establish an SSH connection to it from Centos 7, but when I run the command:

sudo ansible windows -m win_ping

I get:

ansible 2.9.2
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /bin/ansible
  python version = 2.7.5 (default, Aug  7 2019, 00:51:29) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
Using /etc/ansible/ansible.cfg as config file
host_list declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
script declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
auto declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Parsed /etc/ansible/hosts inventory source with ini plugin
META: ran handlers
<192.168.60.144> ESTABLISH SSH CONNECTION FOR USER: xxxxxx
<192.168.60.144> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="xxxxxx"' -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/b3c4c426f9 192.168.60.144 '/bin/sh -c '"'"'echo ~xxxxxx && sleep 0'"'"''
<192.168.60.144> (255, '', 'Permission denied (publickey,password,keyboard-interactive).\r\n')
192.168.60.144 | UNREACHABLE! => {
    "changed": false,
    "msg": "Failed to connect to the host via ssh: Permission denied (publickey,password,keyboard-interactive).",
    "unreachable": true
}


Jordan Borean

unread,
Jan 27, 2020, 4:27:03 PM1/27/20
to Ansible Project
Ansible just runs the ssh binary and reports back what it says. In this case it tried to authenticate using an SSH key with no fallback to password authentication and that failed. You can even run the same command that is displayed to see what happens when you run it manually. You also say you are running Ansible with sudo, why are you doing that? Do you want to use SSH key auth, or are wanting to use password auth.
Reply all
Reply to author
Forward
0 new messages