Try using debug on ec2_info to see what it contains. It seems that
instances is coming back with a list of strings and not a list of
objects like you thought.

On Wed, Jul 9, 2014 at 4:50 AM, Ofer Herman <ofe...@gmail.com> wrote:
> Hi,
>
> I'm using exact_count when  creating an instance on EC2, when the instance
> already exists the next action fails with the following error:
> fatal: [localhost] => One or more undefined variables: 'unicode object' has
> no attribute 'public_ip'
>
> This is the playbook:
> - name: Provision EC2 SC instances
>   local_action:
>         module: ec2
>         region: "{{ aws_region }}"
>         keypair: "{{ aws_keypair }}"
>         group: ansibleDefault
>         instance_type: "{{ aws_instanceType }}"
>         image: "{{ aws_image }}"
>         exact_count: 1
>         count_tag:
>           Class: "websever"
>         vpc_subnet_id: "{{ vpc.subnets[0].id }}"
>         assign_public_ip: True
>         instance_tags: { "Class":"webserver" }
>         wait: yes
>   register: ec2_info
>
> - name: Wait for SSH to come up
>   local_action: wait_for host={{ item.public_ip }} port=22 delay=60
> timeout=320 state=started
>   with_items: ec2_info.instances
>
> How can the playbook continue even if the instance exist?
>
> Thanks,
> Ofer
>
> --
> 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/1f0d1a69-9bf6-4021-9d4f-33b53d907d4b%40googlegroups.com.
> 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/CAJQqANfcEk%2BvanSap0oEw93y-g_-_mxOQo4p-N%2BpO-0Lco64UQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to