| 12345678910111213141516 |
- - name: Find our EC2 instances
- amazon.aws.ec2_instance_info:
- region: "{{ aws_region }}"
- filters: '{ "tag:{{ aws_tag_name }}": "{{ aws_tag_value }}", "instance-state-name": [ "pending", "running" ] }'
- register: aws_ec2
- delegate_to: localhost
- - name: Terminate any running instances
- amazon.aws.ec2_instance:
- instance_ids:
- - "{{ item.instance_id }}"
- region: "{{ aws_region }}"
- state: absent
- wait: yes
- loop: "{{ aws_ec2.instances }}"
- delegate_to: localhost
|