Until now we have been working solely with the tools provided to us by Ansible. This does afford us a lot of power, and make many things possible. However if you have something particularly complex or if you find yourself using the script module a lot, you will probably want to learn how to extend Ansible.
In this chapter, you will learn the following topics:
How to write modules in Bash scripting or Python
Using the custom modules that you have developed
Writing a script to use an external data source as an inventory
Often when you approach something complex in Ansible, you write a script module. The issue with script modules is that you can't process their output, or trigger handlers based on their output easily. So, although the script module works in some cases, using a module can be better.
Use a module instead of writing a script when:
You don't want to run the script every single time
You need to process the output
Your script needs to make facts
You need to send complex...