The first custom module

Writing a custom module does not need to be complicated; in fact, it doesn't even need to be in Python. But since we are already familiar with Python, we will use Python for our custom modules. We are assuming that the module is what we will be using ourselves and our team without submitting back to Ansible, therefore we will ignore some of the documentation and formatting for the time being.

If you are interested in developing modules that can be submitted upstream to Ansible, please consult the developing modules guide from Ansible (https://docs.ansible.com/ansible/latest/dev_guide/developing_modules.html).

By default, if we create a folder named library in the same directory as the playbook, Ansible will include ...

Get Mastering Python Networking - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.