How to convert json to an ansible playbook yaml file
- Step 1Prepare the JSON variable or task definition — Structure the JSON as a flat or nested object for variable files, or as an array of task objects (each with name, module, and args keys) for playbook task lists.
- Step 2Convert to YAML — Paste the JSON and click Convert. Variable objects produce YAML mapping blocks; task arrays produce YAML sequences with - prefixes matching Ansible's task list syntax.
- Step 3Review and add Ansible-specific annotations — Add when conditions, with_items loops, notify handlers, and tags manually after conversion — these are Ansible-specific fields that typically do not exist in the source JSON.
- Step 4Save to the appropriate Ansible directory — Variable files go in group_vars/<group>.yml or host_vars/<host>.yml. Task lists go inside a playbook's tasks: block or in a role's tasks/main.yml file.
Frequently asked questions
How are JSON boolean values mapped in Ansible YAML?+
JSON true and false become YAML true and false (unquoted). Ansible is sensitive to YAML boolean interpretation — strings like 'yes', 'no', 'on', 'off' are also treated as booleans in YAML 1.1. If you need literal string values, quote them explicitly in the output.
Can I use this for dynamic inventory output?+
Yes. Ansible dynamic inventory scripts return JSON, but many playbook authors prefer to review and version inventory data as YAML. Convert the JSON inventory output and save it as a static YAML inventory file for auditing or local testing without the dynamic inventory script.
Is inventory data — including hostnames and credentials — transmitted to JAD Apps?+
No. Conversion runs entirely in your browser using js-yaml. Inventory host data, variable values including encrypted vault strings, and internal hostnames are never transmitted to JAD Apps servers.
Privacy first
Conversion runs locally in your browser. No file is uploaded — only metadata counters are saved for signed-in dashboard stats.