I have a json file in the same directory where my ansible script is. Following is the content of json file:
{ \"resources\":[ {\"name\":\"package1\",
In case if you need to read a JSON formatted text and store it as a variable, it can be also handled by include_vars .
JSON
- hosts: localhost tasks: - include_vars: file: variable-file.json name: variable - debug: var=variable