how to read json file using ansible

Question:

I have a json file in the same directory where my ansible script is. Following is the content of json file:

I am trying to to download these packages using get_url. Following is the approach:

The first task is printing the content of the file correctly but in the second task, I am getting the following error:

Answer:

You have to add a from_json jinja2 filter after the lookup:

Leave a Reply