DEV Community

Cover image for Dealing with binary modules in Ansible Collections
XLAB Steampunk
XLAB Steampunk

Posted on

Dealing with binary modules in Ansible Collections

If you pick a random Ansible module and look under its hood, you will almost certainly find Python or PowerShell code there. But Ansible module can be anything that can consume parameters from the standard input, do some work, and report back the status via the standard output.

Binary Ansible modules can prove useful when installing Python packages to the target host is not desired. Because they can statically link their dependencies, there is usually no need for host modification.

But because nothing is free in this world we live in, they have some drawbacks:

  1. Binary Ansible modules are architecture-specific, which means that we need to provide one module per supported architecture.
  2. Statically-linked binaries tend to be massive compared to scripts.

We can get around the first issue by creating a set of action plugins that dispatch the right module for a target architecture. But there is little we can do about the size, which can be problematic in environments with low network speeds. Also, Ansible Galaxy will reject collections larger than 20 Mb, making collection distribution even harder.

Top comments (0)