WinRM - running ansible on widnows returning error

57 views
Skip to first unread message

nadim mansour

unread,
Nov 1, 2018, 6:20:19 AM11/1/18
to Ansible Project
How can I let ansible run on windows node(windows server 2012 machine) ??
I ran the belwo commands on power shell before running the ansible script :

netsh advfirewall firewall add rule name="Allow WinRM (Http)" dir=in localport=5985 protocol=tcp action=allow enable=yes
netsh advfirewall firewall add rule name="Allow WinRM (Https)" dir=in localport=5986 protocol=tcp action=allow enable=yes



I am recieving the below error 


fatal: [uat_cdxdb]: UNREACHABLE! => {

    "changed": false, 

    "msg": "ssl: HTTPSConnectionPool(host='10.1.116.151', port=5986): Max retries exceeded with url: /wsman (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x108cfd450>: Failed to establish a new connection: [Errno 61] Connection refused',))", 

    "unreachable": true

}







Mohan L

unread,
Nov 1, 2018, 6:38:29 AM11/1/18
to Ansible Project

Run this PowerShell script on your windows machine: https://github.com/ansible/ansible/blob/devel/examples/scripts/ConfigureRemotingForAnsible.ps1

That will configure the necessary changes to allow Ansible to connect to windows. 

nadim mansour

unread,
Nov 1, 2018, 6:45:12 AM11/1/18
to ansible...@googlegroups.com
is thier another way like doing manual steps or rules.
The client will not allow us to run the script on his amchines 
could you please help or advice ?

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/4dde28a7-b35a-4d73-9275-2e249de4b0e1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jordan Borean

unread,
Nov 1, 2018, 8:26:16 AM11/1/18
to Ansible Project
You can look at the script and see what it does to enable the firewall rules. I find it amusing they won't allow scripts when you can still run arbitrary commands.

Thanks

Jordan

nadim mansour

unread,
Nov 1, 2018, 9:07:22 AM11/1/18
to ansible...@googlegroups.com
I am enabling the below rules:

netsh advfirewall firewall add rule name="Allow WinRM (Http)" dir=in localport=5985 protocol=tcp action=allow enable=yes
netsh advfirewall firewall add rule name="Allow WinRM (Https)" dir=in localport=5986 protocol=tcp action=allow enable=yes

but it seems on https a certificate is needed !? cause I am still not able to run ansible on the windows server





--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.

Ankit Vashistha

unread,
Nov 1, 2018, 9:14:03 AM11/1/18
to ansible...@googlegroups.com
Can you share winrm configuration?

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.

Mohan L

unread,
Nov 1, 2018, 10:13:02 AM11/1/18
to Ansible Project
I have not done it manually. 


It looks like he was using SolarWinds Remote Execution Enabler for PowerShell: https://www.solarwinds.com/free-tools/remote-execution-enabler-for-powershell

nadim mansour

unread,
Nov 1, 2018, 10:35:37 AM11/1/18
to Ansible Project
Please find below the screent shot 
I run the two rules command for http and https listener 
and I run winrm qc 

but its listining only to http 

nadim mansour

unread,
Nov 1, 2018, 10:38:26 AM11/1/18
to ansible...@googlegroups.com

Jordan Borean

unread,
Nov 1, 2018, 3:29:15 PM11/1/18
to Ansible Project
Yes you need a certificate for https just like any https endpoint. The Configure script will generate a self signed one for you as it is needlessly complex in older versions of PowerShell to generate your own.
Reply all
Reply to author
Forward
0 new messages