# What is your development workflow for Windows modules?

**URL:** <https://forum.ansible.com/t/what-is-your-development-workflow-for-windows-modules/17624>\
**Category:** Ansible Developer\
**Tags:** windows\
**Created:** [February 25, 2015, 9:48pm UTC](https://forum.ansible.com/t/what-is-your-development-workflow-for-windows-modules/17624 "2015-02-25T21:48:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![John-Paul\_Herold](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@John-Paul\_Herold](https://forum.ansible.com/u/John-Paul_Herold)\
**Post date:** [February 25, 2015, 9:48pm UTC](https://forum.ansible.com/t/what-is-your-development-workflow-for-windows-modules/17624/1 "2015-02-25T21:48:36Z")

</div>

Greetings,

**tl;dr** I’m curious how people are developing windows modules and specifically details about their workflow.

Context: I have been leading the Ansible push in my organization and have recently been getting the Windows teams on board. So far, due to time crunch and lack of experience, our devs have been writing basic powershell scripts (windows modules used when applicable). We now have a little more time though, and I am starting to figure out the best workflow to pass along to the windows devs for transitioning some scripts to modules.

My initial brainstorm:

- company ansible repo with vagrant file for basic local VM with a shared folder. **(done)**
- playbook to configure the vagrant vm as an “ansible-hq” server. I use the same playbook in production for our control server. **(done)**
- windows devs work on modules and save them to the shared folder
- `vagrant ssh` and `~/ansible/hacking/test-module -m /shared/test_module.ps1`
- rinse and repeat

It doesn’t look like the test-module command works with powershell modules (this may be obvious), even on existing core win\_modules (e.g. win\_msi), I got the following output:

`

- including generated source, if any, saving to: /home/jpherold/.ansible\_module\_generated
- this may offset any line numbers in tracebacks/debuggers!

---

<div class="post-metadata">

**Author:** ![j.r.hawkesworth](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@j.r.hawkesworth](https://forum.ansible.com/u/j.r.hawkesworth)\
**Post date:** [February 26, 2015, 9:07am UTC](https://forum.ansible.com/t/what-is-your-development-workflow-for-windows-modules/17624/2 "2015-02-26T09:07:34Z")

</div>

Interesting stuff.

Currently I work stuff up locally using ISE, IDLE and notepad++ (for yaml syntax highlighting) then push changes into our source code repo.

To test stuff, pull and update from source code repo  
set  
ANSIBLE\_KEEP\_REMOTE\_FILES=1  
and run against vms, making liberal use of reverting to a baseline snapshot.

Keep remote files lets you see the full powershell for the module and re-run on the target vm.

I wasn’t aware of hacking/test-module

---

<div class="post-metadata">

**Author:** ![Michael\_Perzel](https://avatars.discourse-cdn.com/v4/letter/m/8491ac/32.png) [@Michael\_Perzel](https://forum.ansible.com/u/Michael_Perzel)\
**Post date:** [March 4, 2015, 10:16pm UTC](https://forum.ansible.com/t/what-is-your-development-workflow-for-windows-modules/17624/3 "2015-03-04T22:16:39Z")

</div>

I follow a similar workflow as jhawkesworth. I usually write the powershell first using notepad++ or similar, get that working on a local windows test box (that can be reverted to a snapshot as needed), and then wrap it in the ansible json parsing etc inside a feature branch off of the ansible-dev branch. Finally write some unit/integration tests and run them with commands similar to:

TEST\_FLAGS=“-t tag\_name -i /etc/ansible/hosts” make playbook

test\_winrm contains a lot of the other windows tests.

---

<div class="post-metadata">

**Author:** ![Gorge](https://avatars.discourse-cdn.com/v4/letter/g/ecae2f/32.png) [@Gorge](https://forum.ansible.com/u/Gorge)\
**Post date:** [June 24, 2015, 3:10am UTC](https://forum.ansible.com/t/what-is-your-development-workflow-for-windows-modules/17624/4 "2015-06-24T03:10:22Z")

</div>

I use Vagrnat vm , create a module file on windows os and get the same error with you.

I think the cause is useless ‘chmod +x’ for our files.

so I open ansible\v1\hacking\test-module (or ansible\hacking\test-module ) and edit like so:

change line 141

`  
invoke = “%s” % (modfile)

`  
to

`  
invoke = “python %s” % (modfile)

`

change line 143

`  
invoke = “%s %s” % (modfile, argspath)

`  
to

`  
invoke = “python %s %s” % (modfile, argspath)

`

now we can get expected output.

---

<div class="post-metadata">

**Author:** ![Gorge](https://avatars.discourse-cdn.com/v4/letter/g/ecae2f/32.png) [@Gorge](https://forum.ansible.com/u/Gorge)\
**Post date:** [June 24, 2015, 3:14am UTC](https://forum.ansible.com/t/what-is-your-development-workflow-for-windows-modules/17624/5 "2015-06-24T03:14:13Z")

</div>

by the way, make sure our module file is save with correct encoding , avoding utf8 with BOM.
