Sorry to somewhat revive an old post, but running this command got past the 401 error for me as well.
I'm following the basic guide from here: http://docs.ansible.com/intro_windows.html So I'm thinking: 1. This be noted on the main page 2. A comment about how to get verbose messages should be mentioned there as well. I know Ansible docs recommend you learn it first and then cross over to the dark side, but #2 would probably be huge on that page (in case there are others just like me that did a tutorial on linux:linux and then thought, wow, lets make this work with Windows!) On Sunday, June 29, 2014 9:11:55 PM UTC-5, Jason Rizio wrote: > > Well I seemed to have got it working by running the following winrm > command on the windows box: > > *winrm set winrm/config/service/auth @{Basic="true"}* > > It looks like by default the winrm service basic authentication setting is > set to false. > > I also had some issues with ansible complaining that it couldnt find > powershell.ps1 in a python module directory - "imported module support code > does not exist". Which is wierd as I have not installed Ansible any other > way apart from using Git - I made sure it was a fresh build and ran source > ./hacking/env-setup to make sure. > > I simply copied the powershell.ps1 script to the folder it was looking for > and it now works. > > *cp /home/ubuntu/ansible/lib/ansible/module_utils/powershell.ps1 > /usr/local/lib/python2.7/dist-packages/ansible-1.7-py2.7.egg/ansible/module_utils/* > > Hope this helps you out Trond. > > > > > > On Monday, June 30, 2014 10:44:19 AM UTC+10, Jason Rizio wrote: >> >> Here are my documented steps: >> >> ** Windows Host Setup >> >> Note: Windows server is using Windows Server Datacenter 2008 with SP2 >> (Amazon EC2) >> >> 1. Install Powershell - .NET 4.5 Framework - >> http://www.microsoft.com/en-us/download/details.aspx?id=30653 >> 2. Install Powershell 3.0 - Windows Management Framework 3.0 - >> http://www.microsoft.com/en-us/download/details.aspx?id=34595 >> 3. Run: pip install >> http://github.com/diyan/pywinrm/archive/master.zip#egg=pywinrm on Ubuntu >> Ansible Control box (Ubuntu 14.04) >> 4. Setup Windows servername (ip-xxxxxxxx) in Ansible hosts file >> 5. Setup group_vars/windows.yml with: >> >> ansible_ssh_user: Administrator >> ansible_ssh_pass: "Password" >> ansible_ssh_port: 5986 >> ansible_connection: winrm >> >> 6. Windows server - Powershell command: Enable-PSRemoting -Force >> 7. Windows server - PowerShell command: Set-ExecutionPolicy RemoteSigned >> 8. Windows server - cmd: NetSH ADVFirewall Set AllProfiles Settings >> remotemanagement Enable >> 9. Created a self signed certificate using the following powershell >> script (Subject name is the server hostname: ip-xxxxxxxx) - >> http://social.technet.microsoft.com/wiki/contents/articles/4714.how-to-generate-a-self-signed-certificate-using-powershell.aspx >> >> - I answered Yes for both Server and Client Authentication (No to >> everything else) >> >> 10. Copied certificate into Trusted Root Certification Authority >> 11. Windows server - cmd: winrm create >> winrm/config/Listener?Address=*+Transport=HTTPS >> >> @{Hostname="ip-xxxxxxxx";CertificateThumbprint="481asaflkdfj8bee1e44c44320598jdsklfj8ecb4a844d"} >> >> 12. Windows server - cmd: winrm delete >> winrm/config/listener?Address=*+Transport=HTTP >> 13. Windows server - cmd: netsh advfirewall firewall add rule >> Profile=public name="Allow WinRM HTTPS" dir=in localport=5986 protocol=TCP >> action=allow >> >> Hope that helps. >> >> cheers, >> Jason >> >> >> On Monday, June 30, 2014 7:02:39 AM UTC+10, Michael DeHaan wrote: >>> >>> Yeah if you want to start a clean one and let us know if you get stuck >>> that would be great. >>> >>> Thank you! >>> >>> >>> On Sun, Jun 29, 2014 at 3:33 PM, Trond Hindenes <[email protected]> >>> wrote: >>> >>>> Thanks Michael, >>>> >>>> I've basically been trying to follow the docs - wondering if I should >>>> try and re-setup my ansible node from the beginning and document each step >>>> as I go. As you can see above i'm *pretty* sure there's nothing wrong >>>> with my remoting endpoint :-) >>>> >>>> These VMs live in Azure, so if it would help I'd absolutely be willing >>>> to let you guys have a look for yourselves. In the meantime I'll just >>>> build >>>> a fresh ansible host. >>>> >>>> -- >>>> 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 [email protected]. >>>> To post to this group, send email to [email protected]. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/ansible-project/28312eb2-1563-43b3-9882-68a8ecf3e3fc%40googlegroups.com >>>> >>>> <https://groups.google.com/d/msgid/ansible-project/28312eb2-1563-43b3-9882-68a8ecf3e3fc%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> -- 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 [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/b2ca87b2-eaa7-4e7c-94a8-8401f5642024%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
