Win custom modules don't work after update to 2.3.1/2.3.2. How to proceed?

34 views
Skip to first unread message

bernard...@virtamed.com

unread,
Aug 22, 2017, 5:27:29 AM8/22/17
to Ansible Project
Hi there! 

I have a number of custom windows modules for Ansible working fine in 2.2. 
I updated today from 2.3.2. and none of these are working anymore... I saw the same behavior in 2.3.1.
I'm thinking the new "windows pipelining" might be the cause.

I tried to troubleshoot further. Using the KEEP_REMOTE_FILES=1 env variable, I was able to check the powershell script and run it manually.
It is actually making both ISE and the powershell console crash without outputting anything. I narrowed it down to the following line: "$output = $entrypoint.Run($payload)".

Did you run into the same issue and managed to fix it?
Any pointer where I could take it from here? Any tip appriciated.

Cheers,

J Hawkesworth

unread,
Aug 22, 2017, 10:10:09 AM8/22/17
to Ansible Project
So the code that executes windows modules was changed between 2.2. and 2.3.  Unfortunately this made debugging a bit more difficult (but gave speed advantages and paved the way for other useful changes I believe).

If you can update to latest devel a more detailed developer guide has been written for windows now.  It doesn't appear to be live on the docs.ansible.com site yet but you can read the instructions now here: https://github.com/jborean93/ansible/blob/6cad8a75598702b9cbe1d38b9a038f72885e072d/docs/docsite/rst/dev_guide/developing_modules_general_windows.rst

Please consider contributing your windows modules.  There is a contribution deadline at the end of this month for community modules, so it might be a bit tight to contribute anything new now but if your modules are something that others might find useful, please consider creating pull requests for them.

By the way, You can now have (powershell module) code shared between modules now (see /lib/ansible/module_utils/powershell/ ) in latest devel. If your custom modules share a lot of common code this could be useful.

All the best,

Jon

bernard...@virtamed.com

unread,
Aug 24, 2017, 8:27:53 AM8/24/17
to Ansible Project
Thanks for your answer! 

I will have another look soon.

It's a bit annoying that modules that were working just fine won't work at all after an update of a minor version. And also to find no information about wether the way we create module changed or not.
This being said, I do appreciate that Ansible (especially Windows support) is getting better and better! Love the idea of sharing code between modules.

Stuff happens :-)

Cheers!

Jordan Borean

unread,
Aug 24, 2017, 5:55:09 PM8/24/17
to Ansible Project
2.3 changed the way that we handled dictionaries from pscustomobjects to hashtables and the way that scripts were executed were dramatically changed to decrease the execution time.

As jhawkesworth has mentioned there is a newer guide available for developing on Windows modules which isn't on the live site yet but you can see it on https://github.com/ansible/ansible/blob/devel/docs/docsite/rst/dev_guide/developing_modules_general_windows.rst. This has got examples of the way to build a basic module structure including how to get parameters and build the result object as well as a guide on how to debug modules since the change of execution made 

Thanks

Jordan
Reply all
Reply to author
Forward
0 new messages