Ansible provides an easy mechanism to utilize custom modules other than those that come with Ansible. As we learned in Chapter 1, TheĀ System Architecture and Design of Ansible, Ansible will search many locations to find a requested module. One such location, and indeed the first location, is the library/ subdirectory of the path where the top-level playbook resides. This is where we will place our custom module so that we can use it in our example playbook.
Modules can also be embedded within roles to deliver the added functionality that a role may depend upon. These modules are only available to the role that contains it or any other roles or tasks executed after the role containing the module. To deliver a module with a role, place the module in the library/ subdirectory of the role's root.