-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdecommission-aws.yml
92 lines (84 loc) · 2.79 KB
/
decommission-aws.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#
# Ansible playbook for decommissioning production-ready infrastructure hosting a deployment of the Hippo CMS product.
#
- name: Hippo CMS | Decomission all required infrastructure
hosts: localhost
connection: local
gather_facts: no
pre_tasks:
- name: Display all variables/facts known for the host
debug: var=hostvars[inventory_hostname] verbosity=4
roles:
# Decommission ECS services (Content Delivery)
- {
role: nginx-hippo-on-ecs,
ecs_service_state: "absent",
component: "contentdelivery",
vpc_name: "{{ cms_vpc_name }}",
ecs_cluster_name: "{{ cms_ecs_cluster_name }}"
}
# Decommission ECS services (Content Authoring)
- {
role: nginx-hippo-on-ecs,
ecs_service_state: "absent",
component: "contentauthoring",
vpc_name: "{{ cms_vpc_name }}",
ecs_cluster_name: "{{ cms_ecs_cluster_name }}"
}
# Decomission the ELB (Content Delivery)
- {
role: aws-elb,
ec2_elb_state: "absent",
vpc_name: "{{ cms_vpc_name }}",
elb_name: "{{ contentdelivery_elb_name }}"
}
# Provision the ELB (Content Authoring)
- {
role: aws-elb,
ec2_elb_state: "absent",
vpc_name: "{{ cms_vpc_name }}",
elb_name: "{{ contentauthoring_elb_name }}"
}
# Decommission ECS Cluster, EC2, Launch Control and Auto Scaling Groups
- {
role: aws-ecs-autoscale,
ecs_cluster_name: "{{ cms_ecs_cluster_name }}",
vpc_name: "{{ cms_vpc_name }}",
ec2_asg_tags: "{{ ec2_tags }}",
ecs_state: "absent"
}
# Decommission the RDS instance (Content Store)
- {
role: aws-rds,
rds_instance_name: "{{ contentstore_database_instance_name }}",
rds_command: "delete"
}
# Get facts on the VPC
- {
role: aws-vpc,
vpc_name: "{{ cms_vpc_name }}",
vpc_region: "{{ cms_vpc_region }}",
vpc_cidr_block: "{{ cms_vpc_cidr_block }}",
vpc_subnets: "{{ cms_vpc_subnets }}",
public_subnet_routes: "{{ cms_public_subnet_routes }}"
}
# Decomission the security groups
- {
role: aws-security-groups,
vpc_region: "{{ cms_vpc_region }}",
vpc_id: "{{ vpc.vpc_id }}",
ec2_group_inbound_sg: "{{ inbound_security_groups }}",
ec2_group_outbound_sg: "{{ outbound_security_groups }}",
ec2_inbound_group_state: "absent",
ec2_outbound_group_state: "absent"
}
# Decomission the VPC
- {
role: aws-vpc,
vpc_name: "{{ cms_vpc_name }}",
vpc_region: "{{ cms_vpc_region }}",
vpc_cidr_block: "{{ cms_vpc_cidr_block }}",
vpc_subnets: "{{ cms_vpc_subnets }}",
public_subnet_routes: "{{ cms_public_subnet_routes }}",
vpc_state: "absent"
}