On Monday, 10 December 2018 18:39:02 CET [email protected] wrote:
> - name: debug
> debug: msg="result is {{ (item.stdout | from_json).hosts }}"
> with_items: "{{ oidLookup_output.results }}"
Your hosts is a list with one element www.google.com
>
> - name: lookup
> debug: msg="IP is {{ lookup('dig', (item.stdout | from_json).hosts,
> wantlist=True) }}"
> with_items: "{{ oidLookup_output.results }}"
So here you are feeding dig a list, it doesn't take a list, only a string.
> TASK [debug]
> *******************************************************************
> ok: [10.239.211.85] => (item={'_ansible_parsed': True,
> '_ansible_item_result': True, u'end': u'2018-12-10 12:34:26.177251',
</snip>
> "stdout": "{\"hosts\": [\"www.google.com\"]}",
> "stdout_lines": [
> "{\"hosts\": [\"www.google.com\"]}"
> ],
> "warnings": []
> },
> "msg": "result is [u'www.google.com']"
Here you clearly see that it's a list and not a string.
--
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 [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/2980419.Iyv8cOm4ia%40x1.
For more options, visit https://groups.google.com/d/optout.