Can you get this using the "ec2_facts" module or are you using the dynamic
inventory script?



On Tue, Oct 28, 2014 at 7:23 PM, Bryan Hunt <[email protected]>
wrote:

>
> I'm writing an ansible demo, showing how to provision Riak clusters, and I
> want to make it super self contained.
>
> With that in mind, I’ve been playing with the ec2.py inventory script, and
> the ansible ec2 module.
>
> Starting the nodes works great (if anyone is interested, I'm happy to
> share the code, or perhaps just make the repo public)
>
> But, I’m having a problem with stopping the nodes.
>
> I have those vars available:
>
> TASK: [List tagged instances]
> *************************************************
> ok: [127.0.0.1] => {
>     "groups[\"tag_instance_type_ansible_demo\"]": [
>         "54.171.160.194"
>     ]
> }
>
> TASK: [everything for that one host]
> ******************************************
> ok: [127.0.0.1] => {
>     "hostvars[\"54.171.160.194\"][\"ec2_id\"]": "i-f28793b0"
> }
>
> The problem is that in order to stop and ec2 instances, I need to get at
> the ec2_id,  in order to feed it to the ec2 module (which stops nodes based
> upon the instance id, not the ip address.
>
>  tasks:
>     - name: shut down all the spot instances
>       local_action:
>        module: ec2
>        region: eu-west-1
>        wait: no
>        instance_ids: '{{ instance_ids }}'
>        state: absent
>
> I can't figure out how to munge this into a usable list, has anyone else
> experienced this before?
>
> Bryan
>
> --
> 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/ccd60225-7c9a-467c-a523-984117641ad5%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/ccd60225-7c9a-467c-a523-984117641ad5%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 [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/CA%2BnsWgwS51OH-zFuCSV5E8t93FNhmz4eUXo%2BHWyup7GiFMwqLw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to