Bootstrap FreeKB - Ansible - Understanding Ansible Library (modules directories)
Ansible - Understanding Ansible Library (modules directories)

Updated:   |  Ansible articles

Library contains the directories that will be searched for modules. If Ansible was installed on a Red Hat system using pip, library should contain the following directories.

/home/john.doe/.ansible/plugins/modules
/usr/share/ansible/plugins/modules
/usr/local/lib/python3.6/site-packages/ansible/modules

 

You can temporarily append directories to library using the ANSIBLE_LIBRARY environment variable. In this example, the /tmp directory is appended.

export ANSIBLE_LIBRARY=/home/joh.doe/.ansible/plugins/modules:/usr/share/ansible/plugins/modules:/usr/local/lib/python3.6/site-packages/ansible/modules:/tmp

 

And then you can echo the ANSIBLE_LIBRARY environment variable to confirm that the /tmp directory was appended.

~]# echo $ANSIBLE_LIBRARY
/home/john.doe/.ansible/plugins/modules:/usr/share/ansible/plugins/modules:/usr/local/lib/python3.6/site-packages/ansible/modules:/tmp

 

You can permanently append one or more library directory in the main ansible.cfg file.

library = /usr/local/ansible/collections/ansible_collections/ansible/posix

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter b00cc8 in the box below so that we can be sure you are a human.