I’m working on a new Ansible module and I would like to use the Ansible test-module script to verify it works, as explained in the official ansible documentation.
The executable is standalone and it works as expected on its own, but running the Ansible test-module
on it fails.
I noticed that, before invoking my executable, the Ansible test-module
does the following:
- It renames the executable into
.ansible_module_generated
(and it places it into my home dir) - It appends a newline at the end of the executable
My executable is in a compressed format and the appended newline corrupts its internal validation. Moreover, the executable requires the original executable name to be preserved, so the renaming is an issue, too.
Is the above behaviour specific to the test-module
- which means that I can easily tweak the test-module
script by stripping out the extra newline and by avoiding the renaming operation - or is it a general Ansible behaviour that the test-module is trying to emulate? Is there any workaround?
[You can also find this question on Stack Overflow at http://stackoverflow.com/questions/23578846/ansible-test-module-corrupting-executable-before-execution]