Ansible - JsonArgs Module Type

About

JsonArgs is a module type. It's a script that contains the following placeholder <<INCLUDE_ANSIBLE_MODULE_JSON_ARGS>> placeholder. During execution, Ansible will replace it with the module parameters.

Process / Dev

  • Create a script with the placeholder <<INCLUDE_ANSIBLE_MODULE_JSON_ARGS>>
json_arguments = """<<INCLUDE_ANSIBLE_MODULE_JSON_ARGS>>"""
  • Ansible will replace the placeholder with the module parameters in Json format before executing
json_arguments = """{"param1": "test's quotes", "param2": "\"To be or not to be\" - Hamlet"}"""

The Json have the following spec:

  • Double quotes are used to quote string values,
  • double quotes inside of string values are backslash escaped,
  • and single quotes may appear unescaped inside of a string value.

Documentation / Reference


Powered by ComboStrap