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
root@ansible:/etc/ansible# cat hosts
[windows]
windows-vm ansible_ssh_host=192.168.1.108root@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
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.