On Thursday, 16 August 2018 21.12.49 CEST J-F Gaudreault wrote:
> The json... returning a list of 2+ objects.
> When the API returns only one object, the brackets are gone.

But when it return multiple entries, which one of them will you have?
If it's the fist element in the list this should work

  {{ nagios_xi_hosts.json.host.host_name | 
default(nagios_xi_hosts.json.host.0.host_name }}

If nagios_xi_hosts.json.host.host_name doesn't exist it will return the 
host_name in the first list element.

-- 
Kai Stian Olstad


-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/4654332.GzN2rU7jZx%40x1.
For more options, visit https://groups.google.com/d/optout.

Reply via email to