0Pricing
Ansible Academy · Lesson

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

  1. When to Build a Custom Module
  2. AnsibleModule & Argument Spec
  3. Return JSON & Honor changed
  4. Support Check Mode in Your Module
← Back to Ansible Academy