scottslowe-learning-tools/ansible/ansible-aws/delete.yml
Scott Lowe 43ab5524a2
Reorganize repository contents
Move contents into new folder structure based on primary technology

Signed-off-by: Scott Lowe <scott.lowe@scottlowe.org>
2017-02-23 16:12:37 -07:00

37 lines
841 B
YAML

---
- hosts: "tag_tool_ansible"
connection: "local"
gather_facts: false
vars:
region: "<insert AWS region here>"
tasks:
- name: "Remove tagged EC2 instances from security group"
ec2:
state: "running"
region: "{{ region }}"
instance_ids: "{{ ec2_id }}"
group_id: ""
delegate_to: "localhost"
- name: "Terminate tagged EC2 instances"
ec2:
state: "absent"
region: "{{ region }}"
instance_ids: "{{ ec2_id }}"
wait: true
delegate_to: "localhost"
- hosts: "localhost"
connection: "local"
gather_facts: false
vars:
region: "<insert AWS region here>"
tasks:
- name: "Remove security group"
ec2_group:
name: "ansible-sec-group"
description: "New SG for Ansible-created instances"
region: "{{ region }}"
state: "absent"