Sharing code in Ansible Collections : ansible
www.reddit.com › r › ansibleSo, we need a place to store shared code. For Ansible modules, things are straightforward: any shared code goes into the `plugins/module_utils` directory. Other types of Ansible plugins can also use code from the `module_utils` directory. But because of some technical details that we will not go into today, not all shared code can live there.
Developing Ansible modules — Ansible Documentation
docs.ansible.com › developing_modules_generalDeveloping Ansible modules. A module is a reusable, standalone script that Ansible runs on your behalf, either locally or remotely. Modules interact with your local machine, an API, or a remote system to perform specific tasks like changing a database password or spinning up a cloud instance. Each module can be used by the Ansible API, or by the ansible or ansible-playbook programs.
Conventions, tips, and pitfalls — Ansible Documentation
docs.ansible.com › ansible › latestDec 21, 2021 · Importing and using shared code Use shared code whenever possible - don’t reinvent the wheel. Ansible offers the AnsibleModule common Python code, plus utilities for many common use cases and patterns. You can also create documentation fragments for docs that apply to multiple modules. Import ansible.module_utils code in the same place as you import other libraries.