As of Ansible 2.2 with_items does not support bare variables.

As such you need to use:

with_items: "{{ ec2_result.instances }}"

Otherwise it will treat ec2_result.instances as a string.


On Thu, Dec 8, 2016 at 7:08 PM Cann <he...@alican.ca> wrote:

> Hi guys , I am having a really hard time with *registered variables*. I
> banged my head around all day.... but could not figure this out. :(
>
> I simply want to register my task result as a variable and access it later
> on.
>
> This is my *debug: var=* result: https://pastebin.mozilla.org/8950629
> and I simply want to get *dns_name*
>
> I call it like this:
>
>
> - name: Wait for servers to boot up
>   wait_for:
>     host: "{{ item.dns_name }}"
>     port: 22
>     delay: 30
>     timeout: 300
>     state: started
>   with_items: ec2_result.instances
>
>
>
> But I am getting error saying that
>
>
> fatal: [localhost]: FAILED! => {"failed": true, "msg": "the field 'args'
> has an invalid value, which appears to include a variable that is
> undefined. The error was: 'unicode object' has no attribute 'dns_name'\n\n
>
>
> Can you guys please point me to right direction?
> Thank you.
>
>
>
>
>
>
>
>
>
> --
>
>
> 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/cff7dbba-13f5-449f-afb8-87c29d9e0636%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/cff7dbba-13f5-449f-afb8-87c29d9e0636%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>
> 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 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/CAD8N0v9Yb6fdOQFLXuUN86v9JCAUYB0O9Rryz%3Do%3DUF3Omor%3Dcg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to