moduleansiblebackport

How to backport Ansible extras module?


For a project I'm working on, I'd love to be able to make use of the maven_artifact module in the Ansible Extras repository.

However, the project uses Ansible stable (currently 1.9.3) and the module is documented as only being available from version 2.0 onwards (which looks to still be in alpha).

What's the best way to "backport" this module to our current Ansible install, across many machines?

Will dropping the "maven_artifact.py" file into the "ansible/modules/extras/packaging/language/" directory on each machine work? Or will the line in the source code:

version_added: "2.0"

prevent it from running due to some sort of compatibility check?

Additionally, how can I tell whether the module relies on features present in Ansible version 2.0 and therefore is incompatible and won't run on 1.9.3 or whether it's just that version 2.0 is when it's set to be introduced?


Solution

  • 2.0 had very minimal changes to the module subsystem- most 2.0 modules will work fine in 1.9.x (there's no version check). The easiest way to use it is to copy the source for the module you want to use from the Github extras repo to a directory called library next to your playbooks. If you have your Ansible content checked into a source-control repo of some kind, put the library directory in there too- then all your Ansible machines where you've checked out your playbook content can run the module without you needing to copy it around manually.