Ansible custom module and custom python library

Hello,

As part of the deployment of an application specific to the business of my company, I developed modules Ansible in Python and for reuse and factorization of code, I also developed a Python library. A bootable playbook installs the Python library on the managed hosts, and then the module that I developed in Python loads this library.

My question: is this way of organizing my developments in conformity with the philosophy of Ansible, especially on the fact that the modules are supposed to be standalone?

Do you think that can be a problem later on?

Thanks for your feedback,

Julien.

In current development (2.3) we've added a 'user definable
module_utils' as a way to share code across custom modules, the same
way we currently do with the shipped lib/ansible/module_utils for all
modules. It works as library/ and other <x>_plugins directories as you
can just add them adjacent to play or in role. A config setting and
var will be created soon to complete the options as for other plugins.

Hello,

I am quite interested in using this functionality and I am on ansible 2.3. However, I was unable to find any documentation on how to use this. Simply setting the environment variable ANSIBLE_MODULE_UTILS_PATH doesn’t seem to work.

Thanks,
Joe

Hello,

I’m also interested by this feature, any news/documentation on that ?

Thanks,

Yassine

docs are basically the same as my response, use a module_utils/ dir
adjactent to play/in role or specify a dir in config in the path
entry, then you can use just like anything in the shipped ansible
module_utils dir.

It works, thanks Brian !