Ansible test-module corrupting executable before execution

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]

Hi Roberto,

I believe I mentioned this on twitter previously, but in case you didn’t see it, support for binary modules isn’t in place just yet - https://github.com/ansible/ansible/pull/6374 - we are currently attacking tickets in priority order and hope to get to this soon.

Basically that’s why test-module doesn’t work ATM with your module.

Hi Michael,

This clarifies things. Thank you very much. Looking forward to binary modules, then.

KR,

Roberto