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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to