Ansible - module_utils
by
Jeremy Canfield |
Updated: October 05 2020
| Ansible articles
By default, module_utils in ansible.cfg is commented out, like this.
#module_utils = /usr/share/my_module_utils/
Typically, the module_utils directory exists in the base Ansible directory (the same directory that contains ansible.cfg), like this.
/etc/ansible/ansible.cfg
/etc/ansible/module_utils
However, I observed that this directory did not exist when installing Ansible using PIP. Instead, the module_utils directory was below the "ansible python module location" directory which can be seen using the ansible --version command.
~]# ansible --version
ansible python module location = /usr/local/lib/python3.6/site-packages/ansible
In this scenario, it probably makes sense to update ansible.cfg to point to the module_utils directory, like this.
module_utils = /usr/local/lib/python3.6/site-packages/ansible/module_utils/
Did you find this article helpful?
If so, consider buying me a coffee over at