Return JSON & Honor changed
Speak the module result protocol.
Modules Speak JSON
When your module finishes, it must hand Ansible a JSON result. That is how the controller learns what happened on the host.
Exit with exit_json
Call module.exit_json on success. It prints the result as JSON and ends the module cleanly with the right exit code.
module.exit_json(changed=True, name='web')All lessons in this course
- When to Build a Custom Module
- AnsibleModule & Argument Spec
- Return JSON & Honor changed
- Support Check Mode in Your Module