could you try running playbook with -vvvvvv this should show a bit more information about how ansible is connecting
also check the event log on the windows host to see if the login request is a success. Something else you could try is to run the python pywinrm example here against your host: https://github.com/diyan/pywinrm Hopefully this should help isolate the problem. Jon On Friday, 26 February 2016 19:14:14 UTC, Julian Saunders wrote: > > I managed to find the root/CIMV2 namespace, and I set the security > permissions of "Execute Methods" and "Remote Enable" and restarted the WMI > and WinRM services. Unfortunately I still receive the same error. > > As I mentioned, I can use WinRM from another Windows server via Powershell > session, without having to have an admin account. Once I have connected > I'm able to run cmd or ipconfig. > > I wonder what Ansible is doing? > > On Monday, 22 February 2016 10:31:33 UTC, J Hawkesworth wrote: >> >> From here it looks like this is possible, although you would have to >> tweak user rights: >> >> >> https://social.technet.microsoft.com/Forums/scriptcenter/en-US/60de5fcd-33e0-479b-9668-fcf683678a2f/winrm-for-nonadministrative-users?forum=ITCG >> >> I get the impression that the intention for WinRM is for admistrative >> access, however. Have a look at the first paragraph of this page: >> https://msdn.microsoft.com/en-us/library/windows/desktop/aa384295(v=vs.85).aspx >> >> Hope this helps. >> >> Please report back if you are able to get this working - knowing the >> minimal set of user rights would be useful for others I think, >> >> Jon >> >> On Saturday, 20 February 2016 16:35:17 UTC, Julian Saunders wrote: >>> >>> Hello, >>> >>> I use Ansible to manage Linux hosts and just recently had a requirement >>> to manage Windows Servers. >>> >>> I have Ansible working against a Windows 2012 R2 host using an account >>> (test_user) that is part of the "administrators" group. >>> >>> I would like reduce the rights of test_user, so it is no longer in the >>> "administrators" group, but can still connect and copy files to its own >>> homedrive, and basically run commands that a user that is part of the >>> "Users" group can. >>> >>> On removing the user Ansible provives the following error: >>> >>> fatal: [servername] => 401 Unauthorized. basic auth failed >>> >>> >>> I did a bit of research and found the user needed to be part of the >>> "Remote Management Users", this would allow test_user to run Powershell >>> remotely. I tested this from another Windows host, and yes it works. >>> >>> >>> PS> $options=New-PSSessionOption -SkipCACheck -SkipCNCheck >>> PS> Enter-PSSession -ComputerName servername -Credential >>> servername\test_user -UseSSL -SessionOption $options >>> >>> >>> However via Ansible I get the following error: >>> >>> fatal: [servername] => failed to exec cmd PowerShell -NoProfile >>> -NonInteractive -EncodedCommand... >>> >>> >>> Does anyone know if it's possible to run Ansible against a Windows hosts >>> with a non admin user? >>> >>> Thanks. >>> >>> -- 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/edd9bc1f-ca9b-4ff5-866f-f01c4de3e5a3%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
