# From RHEL not able to connect to windows VM

**URL:** <https://forum.ansible.com/t/from-rhel-not-able-to-connect-to-windows-vm/29141>\
**Category:** Ansible Project\
**Tags:** windows, rhel\
**Created:** [November 28, 2018, 12:24pm UTC](https://forum.ansible.com/t/from-rhel-not-able-to-connect-to-windows-vm/29141 "2018-11-28T12:24:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Suma\_P](https://avatars.discourse-cdn.com/v4/letter/s/ccd318/32.png) [@Suma\_P](https://forum.ansible.com/u/Suma_P)\
**Post date:** [November 28, 2018, 12:24pm UTC](https://forum.ansible.com/t/from-rhel-not-able-to-connect-to-windows-vm/29141/1 "2018-11-28T12:24:40Z")

</div>

Hi Team ,

I am trying to do a POC on Ansible first time.I am using RHEL as a master and Windows 2012 as a client .Installed ansible 2.7 in RHEL and winrm in windows and done inventory entries in RHEL .

i am getting below error.Kindly help …

**ERROR**

[root@Amaster group\_vars]# ansible web -i inventory.yml -m win\_ping  
18.224.135.4 | UNREACHABLE! =\> {  
“changed”: false,  
“msg”: “Failed to connect to the host via ssh: ssh: connect to host 18.224.135.4 port 22: Connection timed out\r\n”,  
“unreachable”: true

Thanks & Regards,  
Suma

---

<div class="post-metadata">

**Author:** ![Tchia04](https://avatars.discourse-cdn.com/v4/letter/t/fbc32d/32.png) [@Tchia04](https://forum.ansible.com/u/Tchia04)\
**Post date:** [November 28, 2018, 4:51pm UTC](https://forum.ansible.com/t/from-rhel-not-able-to-connect-to-windows-vm/29141/2 "2018-11-28T16:51:50Z")

</div>

By default ansible will use ssh connection which tries to connect to port 22 even if the target host is windows.

In order to tell ansible to connect using winrm which uses port 5985(non-ssl)/5986(ssl), you have to add these variable/settings to your inventory file

ansible\_port: 5986  
ansible\_connection: winrm  
ansible\_winrm\_server\_cert\_validation: ignore  
ansible\_winrm\_transport: ntlm  
ansible\_user: user@windows\_domain.com  
ansible\_password: xxxxxxx

Also, make sure you have ran ConfigureRemotingForAnsible.ps1 on your windows host

–Tony

---

<div class="post-metadata">

**Author:** ![Suma\_P](https://avatars.discourse-cdn.com/v4/letter/s/ccd318/32.png) [@Suma\_P](https://forum.ansible.com/u/Suma_P)\
**Post date:** [November 29, 2018, 1:30pm UTC](https://forum.ansible.com/t/from-rhel-not-able-to-connect-to-windows-vm/29141/3 "2018-11-29T13:30:26Z")

</div>

Hi Tony,

Thanks for your mail.I tried the one which you suggested still not working.actually our windows are using public ip and its not in domain.will that cause issue?

Thanks & Regards,  
Suma
