Just use it as a vars file. vars_file: - '/opt/develop.json'
or via the include_vars module, JSON is a subset of YAML so it can be read as you would any other vars file. On Fri, May 6, 2016 at 5:08 AM, Shwetha Hadimani <[email protected]> wrote: > Hi, > > I have a json file like below called "develop.json" > > { > "releasedata": { > "release_name": "abcd", > "release_number": "22" > } > > Below is my ansible script. I need to fetch release_name from the file. > > --- > - hosts: localhost > vars: > version_file: "{{ lookup('file', '/opt/develop.json') | from_json > }}" > tasks: > - name: print json file > debug: msg= "{{ version_file.releasedata.release_name }}" > > But this is not working. Kindly help me. > > > -- > You received this message because you are subscribed to the Google Groups > "Ansible Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/7afb6ba8-3d29-4eac-9920-6a1c2bc65b5d%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/7afb6ba8-3d29-4eac-9920-6a1c2bc65b5d%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- ---------- Brian Coca -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CACVha7cfY-UbEf3cBtME9H6xQq3bxrahc8fLL%3DGH5NMwSs9oJQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
