June 2017
Intermediate to advanced
446 pages
10h 10m
English
Building upon the last module, let's utilize the common module Boilerplate from Ansible as in the module development documentation at http://docs.ansible.com/ansible/dev_guide/developing_modules_general.html. We will modify the last custom module in custom_module_2.py to utilize ingesting inputs from the playbook.
First, we will import the boilerplate code from ansible.module_utils.basic:
from ansible.module_utils.basic import AnsibleModule if __name__ == '__main__': main()
From there, we can then define the main function where we will house our code. AnsibleModule provides lots of common code for handling returns and parsing arguments. In the following example, we will parse three arguments for host, username
Read now
Unlock full access