I am trying to understand if there is a standard for sharing custom modules. Roles appear to be the way to share code and it sounds like I can include a custom module inside of a role. However, it seems like this complicates how someone would end up using the module since they need to interface through a role:
i.e. Calling a module:
---
- hosts: all
tasks:
- my_module:
say_something: 'Hi'
i.e. Calling a module inside a role:
---
- hosts: all
tasks:
- include_role:
name: my_role
vars:
say_something: 'Hi'
If we do include a module in a role, it seems like we have to write the role as an interface, which is more involved and even duplicates code to accept the variables.
So am I correct on this, or is there something I am missing? And if I am correct, is there any article or best practice on this?