Thanks Kai. That's it. I thought I had read somewhere that dig will accept a list, but clearly not.
On Mon, Dec 10, 2018 at 1:35 PM Kai Stian Olstad < [email protected]> wrote: > 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 a topic in the > Google Groups "Ansible Project" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/ansible-project/j-Adyf2eeWw/unsubscribe. > To unsubscribe from this group and all its topics, 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. > -- 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/CAMc-rNPA4LWaEAPfh%3DVA4KL7o%2BM5eNyswBwjWLsmZ1pbG-inuQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
