Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - name: Get Instance facts
- ec2_instance_facts:
- aws_access_key: "{{ access_key }}"
- aws_secret_key: "{{ secret_key }}"
- region: "{{ aws.region }}"
- filters:
- availability-zone: "{{ aws.az1 }}"
- register: ec2_facts
- # ec2_instance_facts gets me a list of each instance it's facts ec2_facts.0.XXX for example
- How can I loop through and delete something like
- - name: Destroy ec2 instances
- ec2:
- aws_access_key: "{{ presops_access_key }}"
- aws_secret_key: "{{ presops_secret_key }}"
- region: "{{ aws.region }}"
- state: absent
- instance_ids: {{ item }}
- with_items: ec2_facts.item.instance_id
- # I know this is incorrect, but am trying to wrap my head around looping thru the list and getting the instance_id value
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement