Shit. Ok I'm not home now, but I'll try asap. And resend the email
unformatted.

Thanks for replying, i appreciate it!

On Sat, May 12, 2018, 00:38 Tony Chia <tchi...@gmail.com> wrote:

> It seems the "when" for the ec2 task is not lined up. "when" should be
> indented at the same level as ec2 task similar to the debug task
>
>
> On Thursday, May 10, 2018 at 2:27:06 PM UTC-7, David Villasmil wrote:
>>
>> hello all,
>>
>> I run "ec2_instance_facts" to get some instance_ids:
>>
>> - ec2_instance_facts:
>> region: us-east-1
>> filters:
>> "tag:Name": "*{{ cluster }}*"
>> register: ec2_res
>>
>>
>> Then i can properly print the instance_ids only for those running:
>>
>> - name: print ips
>> debug: "msg={{ item.instance_id }}"
>> with_items: "{{ ec2_res.instances }}"
>> when: item.state.name == "running"
>>
>> _BUT_ I can't terminate them, i trying like this:
>>
>> - name: Terminate instances that were previously launched
>> ec2:
>> state: "absent"
>> instance_ids: "{{ item.instance_id }}"
>> when: item.state.name == "running"
>> with_items: "{{ ec2_res.instances }}"
>>
>>
>> But this fails with:
>>
>> fatal: [127.0.0.1]: FAILED! => {
>>     "msg": "The task includes an option with an undefined variable. The
>> error was: 'item' is undefined\n\nThe error appears to have been in
>> '/home/admin/voice-conf/playbooks/add_fs_to_cluster.yml': line 34, column
>> 5, but may\nbe elsewhere in the file depending on the exact syntax
>> problem.\n\nThe offending line appears to be:\n\n\n  - name: Terminate
>> instances that were previously launched\n    ^ here\n"
>> }
>>
>>
>> some help is appreciated!
>>
>> David
>>
> --
> 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/b3015d67-7e06-49b4-9390-daa98a548c28%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/b3015d67-7e06-49b4-9390-daa98a548c28%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/CAFGRPVqq9x4-3MJ0LFmX6%2B7N-fUQpmDR4BqXRUd3V04uxF%3DtnA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to