Where to put shared code of modules

Hi

I am developing modules for cloudstack https://github.com/resmo/ansible-cloudstack and having a bunch of modules which have some similar common code. I would like to separate this code into a separate file which can be imported (DRY).

Where can I put this code? Would be https://github.com/ansible/ansible/tree/devel/lib/ansible/module_utils the right place?

I expect the modules go into modules-extra repo, does it matter?

Thanks for clarification.

Yours
René

Yes, module_utils is the correct place for shared module code, it does
not matter in which repo the module resides.
You can check the openstack and amazon modules that already have
shared code there.

​Wouldn't it make sense to have that share code within the modules
repository? Basically making module_utils also pluggeable perhaps?

We have had discussions on this, even moving all plugins to the
core/extras repos, not just library modules. But most of this will
have to wait until 1.9 is out and v2 is the main devel.

I'm remiss to open a topic in ansibl-devel about it until we have
actual time to do something about it.

​That's perfect!​