library/module_utils functionality question

4 views
Skip to first unread message

Arthur Reyes

unread,
Feb 13, 2018, 11:41:00 AM2/13/18
to Ansible Project
If a module with the same name as a core module exists in the ./library or ./module_utils directory of the plabyook, which module will be get invoked when I reference it in my playbook?

I have a need to modify the functionality of a core module. I could refactor/rename it to [module]_internal or simply copy the module to ./library and add the needed functionality, so I'm curious how others have approached this. I see benefits of creating a new (renamed) module with the added functionality and refactoring my playbook to invoke this module instead, but there's other benefits to just slipping the modified module directly into the ./library directory so that no further changes are required in the playbook.

Thoughts?

Arthur Reyes

unread,
Feb 13, 2018, 1:04:32 PM2/13/18
to Ansible Project
Follow-up. I tested copying a module from core into the playbook library. Modifying the content, without altering the module name and observed that ansible.library picked up the local module first.
Reply all
Reply to author
Forward
0 new messages