This feels like it belongs in the inventory plugin, so it is automatic, can you expand on thoughts?
-- Michael On Mar 8, 2014, at 6:05 PM, Scott Anderson <[email protected]> wrote: Yes, I just opened a pull request for a module I've written to aid in tasks like this: https://github.com/ansible/ansible/pull/6349 Example: - name: Obtain list of existing stopped instances with tag 'environment' equal to 'prod' local_action: module: ec2_instance_facts states: - stopped tags: environment: "prod" region: "{{ vpc_region }}" aws_access_key: "{{ aws_access_key }}" aws_secret_key: "{{ aws_secret_key }}" register: instance_facts ignore_errors: yes - name: Start the stopped instances local_action: module: ec2 state: running instance_ids: "{{ item.id }}" wait: yes wait_timeout: 600 region: "{{ vpc_region }}" aws_access_key: "{{ aws_access_key }}" aws_secret_key: "{{ aws_secret_key }}" with_items: instance_facts.instances Regards, -scott On Friday, March 7, 2014 12:43:31 PM UTC-5, [email protected] wrote: > > Hey all, > > I'm trying to use the EC2 module to start/stop instances, but I don't have > the specific IDs ahead of time. I've been trying to get it to run one task > to grab the IDs from the EC2 inventory, and one to actually run the command > on localhost, but I can't seem to find a way to match both. I either get > "no hosts match" (when I use a [local] inventory) or I cannot find > localhost when using the ec2 inventory. > > Is there an example anywhere of collecting ec2 instance ids and reusing > them? > -- 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/9e844fb4-6492-4bfe-9796-890b50440e63%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/9e844fb4-6492-4bfe-9796-890b50440e63%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/6929098474450040178%40unknownmsgid. For more options, visit https://groups.google.com/d/optout.
