a copy of the json would be helpful.

On Thu, Aug 16, 2018 at 2:57 PM J-F Gaudreault <[email protected]> wrote:

> Hi! I getting a json from an API request. I've registered the json in a
> var.
>
> I'm trying to find a way to get the hostname in the json.
> I need to find it even if it has brackets or not.
>
> I only got this far ....
>
>
> with brackets:
>
> - name: test1
>   debug:
>     msg: "{{ nagios_xi_hosts | json_query('json.host[0].host_name') }}"
>
> no brackets:
>
> - name: test2
>   debug:
>     var: nagios_xi_hosts.json.host.host_name
>
>
>
>
> --
> 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/7091e4ea-4272-4697-8558-1fc82bff2562%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/7091e4ea-4272-4697-8558-1fc82bff2562%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 

Jonathan lozada de la matta

AUTOMATION CONSULTANT - AUTOMATION PRACTICE

Red Hat Consulting Services <https://www.redhat.com/>

[email protected]

-- 
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/CAFYJA%2BKHBdNCdzh-M2T36%2BKhaTBbH74UrUABhugjNMBCwOGwzA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to