# Connection problem with a windows client from redhat server

**URL:** <https://forum.ansible.com/t/connection-problem-with-a-windows-client-from-redhat-server/21652>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [June 2, 2016, 7:53pm UTC](https://forum.ansible.com/t/connection-problem-with-a-windows-client-from-redhat-server/21652 "2016-06-02T19:53:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mahi](https://avatars.discourse-cdn.com/v4/letter/m/d78d45/32.png) [@Mahi](https://forum.ansible.com/u/Mahi)\
**Post date:** [June 2, 2016, 7:53pm UTC](https://forum.ansible.com/t/connection-problem-with-a-windows-client-from-redhat-server/21652/1 "2016-06-02T19:53:47Z")

</div>

Im new to ansible .Getting connection refused error while doing ping to windows client machines. Could any one help me where i am doing wrong.

ansible server OS version: REDHAT 6.7

client os: windows 2012 R2  
client firewall status: disabled  
Im able to do ping /telnet to client machine from server.

getting connection error while doing ping

`  
[root@stonecold ansible]# ansible windows -i hosts -m win\_ping -vvvvv  
/usr/lib/python2.6/site-packages/pycrypto-2.6.1-py2.6-linux-x86\_64.egg/Crypto/Util/number.py:57: PowmInsecureWarning: Not using mpz\_powm\_sec. You should rebuild using libgmp \>= 5 to avoid timing attack vulnerability.  
\_warn(“Not using mpz\_powm\_sec. You should rebuild using libgmp \>= 5 to avoid timing attack vulnerability.”, PowmInsecureWarning)  
No config file found; using defaults  
Loaded callback minimal of type stdout, v2.0  
Using module file /usr/lib/python2.6/site-packages/ansible-2.2.0-py2.6.egg/ansible/modules/core/windows/win\_ping.ps1  
\<my\_machine\> ESTABLISH WINRM CONNECTION FOR USER: Administrator on PORT 5986 TO my\_machine  
\<my\_mahcine\> WINRM CONNECT: transport=ssl endpoint=https://my\_machine:5986/wsman  
\<my\_machine\> WINRM CONNECTION ERROR: 500 WinRMTransport. [Errno 111] Connection refused  
Traceback (most recent call last):  
File “/usr/lib/python2.6/site-packages/ansible-2.2.0-py2.6.egg/ansible/plugins/connection/winrm.py”, line 152, in \_winrm\_connect  
self.shell\_id = protocol.open\_shell(codepage=65001) # UTF-8  
File “/usr/lib/python2.6/site-packages/winrm/protocol.py”, line 121, in open\_shell  
rs = self.send\_message(xmltodict.unparse(rq))  
File “/usr/lib/python2.6/site-packages/winrm/protocol.py”, line 193, in send\_message  
return self.transport.send\_message(message)  
File “/usr/lib/python2.6/site-packages/winrm/transport.py”, line 138, in send\_message  
raise WinRMTransportError(‘http’, ex.reason)  
WinRMTransportError: 500 WinRMTransport. [Errno 111] Connection refused

my\_machine | UNREACHABLE! =\> {  
“changed”: false,  
“msg”: “ssl: 500 WinRMTransport. [Errno 111] Connection refused”,  
“unreachable”: true  
}  
`

Host file:

`[windows] my_machine`

Yaml file:  
`

ansible\_user: Administrator  
ansible\_pass: my\_pass  
ansible\_port: 5986  
ansible\_connection: winrm  
ansible\_winrm\_server\_cert\_validation: ignore  
`

Regards,  
Mahi

---

<div class="post-metadata">

**Author:** ![Johannes\_Kastl](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@Johannes\_Kastl](https://forum.ansible.com/u/Johannes_Kastl)\
**Post date:** [June 3, 2016, 7:15am UTC](https://forum.ansible.com/t/connection-problem-with-a-windows-client-from-redhat-server/21652/2 "2016-06-03T07:15:48Z")

</div>

There have been lots of threads here recently regarding windows  
targets, search the archive for winrm.

Maybe Jeff, Matt and Mike can help...

Johannes

---

<div class="post-metadata">

**Author:** ![Mike\_Fennemore](https://avatars.discourse-cdn.com/v4/letter/m/45deac/32.png) [@Mike\_Fennemore](https://forum.ansible.com/u/Mike_Fennemore)\
**Post date:** [June 3, 2016, 6:35pm UTC](https://forum.ansible.com/t/connection-problem-with-a-windows-client-from-redhat-server/21652/3 "2016-06-03T18:35:09Z")

</div>

Have you run the configure for ansible powershell script from the Ansible documentation?

---

<div class="post-metadata">

**Author:** ![Mahi](https://avatars.discourse-cdn.com/v4/letter/m/d78d45/32.png) [@Mahi](https://forum.ansible.com/u/Mahi)\
**Post date:** [June 4, 2016, 1:04pm UTC](https://forum.ansible.com/t/connection-problem-with-a-windows-client-from-redhat-server/21652/4 "2016-06-04T13:04:52Z")

</div>

Thanks for reply Mike.

Yes. its working fine after running ps1 script in windows machine. (source: [https://github.com/ansible/ansible/blob/devel/examples/scripts/ConfigureRemotingForAnsible.ps1](https://github.com/ansible/ansible/blob/devel/examples/scripts/ConfigureRemotingForAnsible.ps1)).

Could you please confirm, do i need to run on every windows machine to access.(one time) ?

Regards,  
Mahi.

---

<div class="post-metadata">

**Author:** ![gdelgado2](https://avatars.discourse-cdn.com/v4/letter/g/cdc98d/32.png) [@gdelgado2](https://forum.ansible.com/u/gdelgado2)\
**Post date:** [June 4, 2016, 2:24pm UTC](https://forum.ansible.com/t/connection-problem-with-a-windows-client-from-redhat-server/21652/5 "2016-06-04T14:24:27Z")

</div>

Hello Mahi,

Yes, that is correct you need to run the script once on each host you want Ansible to manage. You can use Group Policy to push the script to your hosts and after that Ansible takes care of the management.

Thanks…
