Basic question about managing Windows targets with Ansible

I started playing around with Ansible (1.9.2) today for the first time (first time using any software in this category before), with the goal of running a number of deploy steps on a Windows machine. I went through the setup instructions and I believe I have everything configured properly, such that I can run playbooks with tasks based on windows-specific modules (win_ping, win_stat, etc).

After convincing myself that I could run those basic commands, I wanted to try to clone a git repo to the remote Windows machine using the git module, but kept on getting error messages like:

Module command not found in configured module paths. Additionally, core modules are missing.

I think this warning is specious, since I can run basically the same git task locally on my mac through ansible using a modified playbook. It then dawned on me that perhaps none of the standard core modules are actually supported on windows. Reading through the windows intro in the docs (http://docs.ansible.com/ansible/intro_windows.html) again, I realized that the “What modules are available” section is actually a bit vague.

I was hoping someone could clarify, whether it’s the case that if a module isn’t specifically a windows module, then basically it doesn’t work on windows targets. In that case, am I correct in my understanding that the only mode of executing custom tasks on windows targets is to do it via powershell scripts (using the “script” module)?

Any insight from more experienced users would be much appreciated.

Thanks,
Josh

use on windows is described here http://docs.ansible.com/ansible/intro_windows.html

list of windows modules here, http://docs.ansible.com/ansible/list_of_windows_modules.html

workaround for a current winrm bug here, https://github.com/ansible/ansible/issues/10294#issuecomment-93629047

that workaround will work for ansible-playbook. to enable the ‘ansible’ command itself, put these lines in your ansible.cfg
bin_ansible_callbacks = True
callback_plugins = path/to/fix-ssl.py

Thanks for those resources, but I already have Ansible set up that I can communicate with a windows server using windows specific modules. The general question was whether those were the only modules that are useable with windows besides “script” and a few others, and whether for most functionality you basically just had to write powershell scripts.

For now those are the only ones i know of. when wmf 5 is out, we can use dsc from ansible, and i think that will become the staple of how we manage windows. if you want to try it,

https://github.com/trondhindenes/Ansible-win_dsc

This actually hit me pretty hard too buddy! I had the same confusion! Luckily only a subset of of the machines I managed are Windows. I am able to get enough things done with the modules that are available now, but anything intricate has made me dive into my powershell-fu. At this point I would usually head over to another option ala chef/puppet, but I like how Ansible is approaching the problem. This is the first time I am following a project intimately and trying cutting edge features as they come out (I am on v2.0.0-0.2.alpha2). My boss isn’t particularly happy with me ;D

Wednesday, August 26, 2015 at 5:24:21 PM UTC-4, Joshua Adelman wrote:

Windows support is still in its infancy, so getting good coverage will take some time. On nodes with WMF5 we will be able to use DSC resouces “directly” (I’ve written a script which generates an Ansible module from a DSC resource, found here: https://github.com/trondhindenes/AnsibleDscModuleGenerator), which will expand coverage drastically.

Also, writing Ansible modules using Powershell is actually super-easy so if you have a script which does what you want to do, it doesn’t take much coding to turn it into a working module. Even if you’re not permitted to submit your custom modules back to the project I’d highly recommend looking at that option.