Anyone able to help?

On Thursday, May 10, 2018 at 11:27:06 PM UTC+2, 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 [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/80df7e3e-b1f7-4906-8673-790c0e975b4e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to