Reputation: 1410
I want to tweak one Ansible module, I am using multiple modules. Now I want minor tweaks in one of them. How can I override default code?
I am not sure but my assumption is if I created a similar directory structure of modules in current directory, it will refer this code and for rest of module it will refer default code eg. for yum_repository module
, default path is:
/usr/local/Cellar/ansible/2.4.1.0/libexec/lib/python2.7/site-packages/ansible/modules/packaging/os/yum_repository.py
but If I create the directory structure in my working directory as:
ansible/modules/packaging/os/
and keep edited file yum_repository.py
there, it should refer this edited file.
Upvotes: 5
Views: 1709
Reputation: 68469
Ansible will look for modules in ./library
subdirectory of the playbook dir.
You can also use library
parameter in the Ansible configuration file to specify a common directory for your modules.
Upvotes: 6