unable to ping windows machine using ansible

5,380 views
Skip to first unread message

Sameer Modak

unread,
Feb 18, 2018, 6:49:20 AM2/18/18
to Ansible Project
Below is the configuration and its corresponding error,
[windows]
192.168.1.102
[windows:vars]
ansible_ssh_user=smodak
ansible_ssh_pass=******
ansible_ssh_port=5986
ansible_connection=winrm
ansible_winrm_server_cert_validation=ignore
=========================================================

[root@hackerdev ansible]# ansible -vvv windows -m win_ping 
Using /etc/ansible/ansible.cfg as config file
META: ran handlers
Using module file /usr/lib/python2.7/site-packages/ansible/modules/windows/win_ping.ps1
<192.168.1.102> ESTABLISH WINRM CONNECTION FOR USER: smodak on PORT 5986 TO 192.168.1.102
192.168.1.102 | UNREACHABLE! => {
    "changed": false, 
    "msg": "ssl: HTTPSConnectionPool(host='192.168.1.102', port=5986): Max retries exceeded with url: /wsman (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x3623650>: Failed to establish a new connection: [Errno 111] Connection refused',))", 
    "unreachable": true
}


What is going wrong ?????

is it something missing on windows machine??????/

Jeremie Levy

unread,
Feb 18, 2018, 9:40:14 AM2/18/18
to Ansible Project
Your config should look like this:
ansible_user: username
#password goes here when you don't want to use -k option.
ansible_password: password
ansible_port: 5986
ansible_connection: winrm
ansible_winrm_transport: kerberos
ansible_winrm_scheme: https
ansible_winrm_server_cert_validation: ignore
ansible_winrm_kerberos_delegation: true


Tony Chia

unread,
Feb 18, 2018, 2:09:13 PM2/18/18
to Ansible Project
What happends when you run "telnet 192.168.1.102" on the ansible controller box?

On the windows box, did you run the script ConfigureRemotingForAnsible.ps1 which you can obtain from here
Reply all
Reply to author
Forward
0 new messages