A role can hold modules in the library folder. To activate a module in a playbook, you need to add this role first to your playbook or as a dependency of another role. Otherwise Ansible does not know the contained modules. A role providing a module is not required to have anything else like tasks defined. Simply put your library
folder inside and of course the required meta/main.yml
Since Ansible 2.0 this even works with (most) plugins, e.g. action plugins, or callback plugins can be put into the folder action_plugins
or callback_plugins
etc. I think connection, vars and strategy plugins do not work this way, but that is for obvious reasons. Those kind of plugins work on playbook level so they can not be loaded through roles.