Connection problem with a windows machine since ansible

6,191 views
Skip to first unread message

youmarva

unread,
Nov 8, 2014, 7:03:45 AM11/8/14
to ansible...@googlegroups.com
Hi,

I recently install Ansible 1.8, and I'm testing its fonctionnality
I recently installed Ansible 1.8 on Debian 7.1, I test its functionality in order to work with.

But testing the functionality of Windows logon, I have a connection error as shown below:

root@ansible:/etc/ansible# ansible windows-vm -m win_ping -vvvv
<192.168.1.108> ESTABLISH WINRM CONNECTION FOR USER: administrateur on PORT 5986 TO 192.168.1.108
<192.168.1.108> WINRM CONNECT: transport=plaintext endpoint=https://192.168.1.108:5986/wsman
<192.168.1.108> WINRM CONNECTION ERROR: 500 WinRMTransport. [Errno 111] Connection refused
<192.168.1.108> WINRM CONNECT: transport=plaintext endpoint=http://192.168.1.108:5986/wsman
<192.168.1.108> WINRM CONNECTION ERROR: 500 WinRMTransport. [Errno 111] Connection refused
openerpb
| FAILED => 500 WinRMTransport. [Errno 111] Connection refused

I create a file windows.yml
under  /etc/ansible/group_vars indicating in the pameters of my windows server and I added the address of my host in the /etc/ansible/hosts.

root@ansible:/etc/ansible# cat hosts
[windows]
windows
-vm ansible_ssh_host=192.168.1.108


root@ansible:/etc/ansible# cat group_vars/windows.yml
# it is suggested that these be encrypted with ansible-vault:
# ansible-vault edit group_vars/windows.yml

ansible_ssh_user
: administrateur
ansible_ssh_pass
: password
ansible_ssh_port
: 5986
ansible_connection
: winrm


This error is due to what do you think?
Thank you for help


youmarva

J Hawkesworth

unread,
Nov 10, 2014, 12:26:09 PM11/10/14
to ansible...@googlegroups.com
Just checking, have you run the powershell script to enable remoting on your windows-vm machine?


and this script here:


Until the script is run I would expect your windows-vm to refuse connections.

youmarva

unread,
Nov 21, 2014, 8:58:24 AM11/21/14
to ansible...@googlegroups.com
Thanks J Hawkesworth for your response.
I resolve the problem at the end by doing this steps in a windows 7 sp1 and in a windows server 2012:

1 - run powershell as an administrator
2 - For Remote Signed, run Set-ExecutionPolicy RemoteSigned.
3 - For Unrestricted, run Set-ExecutionPolicy Unrestricted.
4 - Verify that the command did not produce any errors.
5 - Type Exit at the PowerShell command prompt.

If in executing this script we have the error below (in windows 7 sp1):
> .\ConfigureRemotingForAnsible.ps1
-->.ps1 : PowerShell/Windows Management Framework needs to be updated to 3 or higher. Stopping script

we should execute
:
> C:\Users\admin\Documents\Ansible> .\upgrade_to_ps3.ps1


    R
épertoire : C:\


Mode                LastWriteTime     Length Name
----                -------------     ------ ----
d
----        10/11/2014     14:19            powershell


C
:\Users\admin\Documents\Ansible> .\ConfigureRemotingForAnsible.ps1
WinRM a été mis à jour pour recevoir des demandes.
Le type du service WinRM a été correctement modifié.

WinRM a été mis à jour pour la gestion à distance.
Écouteur WinRM créé sur HTTP://* pour accepter les demandes de la gestion des services Web sur toutes les adresses IP d
e cet ordinateur
.
Exception de pare-feu WinRM activée.



wxf                
: http://schemas.xmlsoap.org/ws/2004/09/transfer
a                  
: http://schemas.xmlsoap.org/ws/2004/08/addressing
w                  
: http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd
lang                
: fr-FR
Address             : http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
ReferenceParameters : ReferenceParameters

Ok.


in case it can help someone else
(Sorry for my english)

Youmarva

Igal Dahan

unread,
Aug 10, 2015, 7:45:37 AM8/10/15
to Ansible Project
Hi

im using my own AMI based on win 2012 R2 and i have followed your procedure and also removed all firewalls 

im not using any domain which means no kerberos is needed.

and still got this error :

[igal@localhost temp]$ ansible windows -i hosts -m win_ping -vvvvv
<172.26.2.34> ESTABLISH WINRM CONNECTION FOR USER: dev_user on PORT 5985 TO 172.26.2.34
<172.26.2.34> WINRM CONNECT: transport=plaintext endpoint=http://172.26.2.34:5985/wsman
<172.26.2.34> WINRM CONNECTION ERROR: 401 Unauthorized.
<172.26.2.34> WINRM CONNECT: transport=plaintext endpoint=https://172.26.2.34:5985/wsman
<172.26.2.34> WINRM CONNECTION ERROR: 500 WinRMTransport. [SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:590)
172.26.2.34 | FAILED => 500 WinRMTransport. [SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:590)

J Hawkesworth

unread,
Aug 12, 2015, 3:43:19 PM8/12/15
to Ansible Project
Since you are getting a 401 Unauthorised response I think maybe you have not supplied the correct password for dev_user 

Try checking the event log on the windows machine to see if the login request is being denied.

What port have you set in your group_vars for talking to windows - it looks like it is 5985.  I suspect it is only trying https because the http connection failed because the password supplied for the user was incorrect (or perhaps the local user does not exist on your destination machine).

Hope this helps,

Jon
Reply all
Reply to author
Forward
0 new messages