Skip to content

Instantly share code, notes, and snippets.

@thom8
Created November 20, 2015 00:39
Show Gist options
  • Save thom8/7f19fc1682907fbaa0bf to your computer and use it in GitHub Desktop.
Save thom8/7f19fc1682907fbaa0bf to your computer and use it in GitHub Desktop.
ansible-playbook termina-playbook.yml -e "project=<project>" -e "branch=<branch>"
---
- hosts: "tag_UID_{{ (branch+project) | checksum }}"
gather_facts: True
connection: local
vars:
- dns_zones:
- domain1.com
- domain2.com
- branch_shortname: "{{ branch | basename }}"
tasks:
- name: Terminate instances
local_action: ec2
state=absent
instance_ids="{{ ec2_id }}"
region=ap-southeast-2
- name: Delete DNS entry on route 53
route53:
command: delete
zone: "{{ item }}"
record: "{{ branch_shortname | lower() }}.{{ project }}.{{ item }}"
overwrite: yes
type: A
ttl: 60
value: "{{ ec2_ip_address }}"
with_items: dns_zones
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment