# Using compiled modules in Ansible?

**URL:** <https://forum.ansible.com/t/using-compiled-modules-in-ansible/14409>\
**Category:** Ansible Developer\
**Created:** [January 23, 2014, 8:01pm UTC](https://forum.ansible.com/t/using-compiled-modules-in-ansible/14409 "2014-01-23T20:01:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jcoats](https://avatars.discourse-cdn.com/v4/letter/j/ea666f/32.png) [@jcoats](https://forum.ansible.com/u/jcoats)\
**Post date:** [January 23, 2014, 8:01pm UTC](https://forum.ansible.com/t/using-compiled-modules-in-ansible/14409/1 "2014-01-23T20:01:14Z")

</div>

I’ve been using Ansible lately and needed to be able to copy over Ansible modules that are compiled to executable binaries. While bash scripts, etc., work fine, it looks like Ansible runner’s \_transfer\_str() method that’s called on every module requires the module to be parseable UTF-8, which takes binaries out of the running.

At first glance, it looks like it should be easily solved with a few lines of code to allow a binary=True flag (or something) that the \_copy\_module() method could pass to \_transfer\_str(), but I was wondering: is this a problem that’s already been brought to light, with a workaround or a rationale as to why it shouldn’t be solved? If not, I could just patch this up, test it out, and send a pull request.

Thanks,

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [January 23, 2014, 9:09pm UTC](https://forum.ansible.com/t/using-compiled-modules-in-ansible/14409/2 "2014-01-23T21:09:11Z")

</div>

Yep!

It’s been brought up a few times, I’d quite interested in patches that implemented this.

It probably seems that it could be dealt with my seeing if the file was binary (run ‘file’ or something better) and take care of business.

There’s definitely _not_ a reason why this shouldn’t be solved, the 'old style" (non Python) module path will still pass in a “key=value” arguments line to the file passed to $ARGV[1] of the module, however. There’s a bit of a hack in there to tell if the module indicates it wants JSON data.

I suspect that if we detect the module is binary it should assume it wants JSON, since that’s going to be the better way to pass variables almost all of the time – what’s included there is for compatibility reasons and ease of use from bash more so than anything.

Does this make sense?

I’m definitely interested in patches for this, one or two people have been interested in modules written in Go, in particular.

Thanks!

–Michael
