commit | author | age
|
00ffb6
|
1 |
AWSTemplateFormatVersion: "2010-09-09" |
S |
2 |
Mappings: |
|
3 |
RegionMapping: |
58c5bb
|
4 |
us-east-1: |
GC |
5 |
RHELAMI: ami-b63769a1 |
|
6 |
WIN2012R2AMI: ami-93118ee9 |
|
7 |
us-east-2: |
|
8 |
RHELAMI: ami-0932686c |
|
9 |
WIN2012R2AMI: ami-72745d17 |
|
10 |
us-west-1: |
|
11 |
RHELAMI: ami-2cade64c |
|
12 |
WIN2012R2AMI: ami-ef95ae8f |
|
13 |
us-west-2: |
|
14 |
RHELAMI: ami-6f68cf0f |
|
15 |
WIN2012R2AMI: ami-af5980d7 |
|
16 |
eu-west-1: |
|
17 |
RHELAMI: ami-02ace471 |
|
18 |
WIN2012R2AMI: ami-24f04d5d |
|
19 |
eu-west-2: |
|
20 |
WIN2012R2AMI: ami-6a746a0e |
|
21 |
ca-central-1: |
|
22 |
WIN2012R2AMI: ami-4e4cf72a |
|
23 |
eu-central-1: |
|
24 |
RHELAMI: ami-e4c63e8b |
|
25 |
WIN2012R2AMI: ami-88c14ee7 |
|
26 |
ap-northeast-1: |
|
27 |
RHELAMI: ami-5de0433c |
|
28 |
WIN2012R2AMI: ami-dcdd66ba |
|
29 |
ap-northeast-2: |
|
30 |
RHELAMI: ami-44db152a |
|
31 |
WIN2012R2AMI: ami-681cbb06 |
|
32 |
ap-southeast-1: |
|
33 |
RHELAMI: ami-2c95344f |
|
34 |
WIN2012R2AMI: ami-f887d59b |
|
35 |
ap-southeast-2: |
|
36 |
RHELAMI: ami-39ac915a |
|
37 |
WIN2012R2AMI: ami-f601f494 |
|
38 |
sa-east-1: |
|
39 |
RHELAMI: ami-7de77b11 |
|
40 |
WIN2012R2AMI: ami-42a5e12e |
|
41 |
ap-south-1: |
|
42 |
RHELAMI: ami-cdbdd7a2 |
|
43 |
WIN2012R2AMI: ami-b9e8a6d6 |
00ffb6
|
44 |
DNSMapping: |
S |
45 |
"us-east-1": |
|
46 |
domain: "us-east-1.compute.internal" |
|
47 |
"us-west-1": |
|
48 |
domain: "us-west-1.compute.internal" |
|
49 |
"us-west-2": |
|
50 |
domain: "us-west-2.compute.internal" |
|
51 |
"eu-west-1": |
|
52 |
domain: "eu-west-1.compute.internal" |
|
53 |
"eu-central-1": |
|
54 |
domain: "eu-central-1.compute.internal" |
|
55 |
"ap-northeast-1": |
|
56 |
domain: "ap-northeast-1.compute.internal" |
|
57 |
"ap-northeast-2": |
|
58 |
domain: "ap-northeast-2.compute.internal" |
|
59 |
"ap-southeast-1": |
|
60 |
domain: "ap-southeast-1.compute.internal" |
|
61 |
"ap-southeast-2": |
|
62 |
domain: "ap-southeast-2.compute.internal" |
|
63 |
"sa-east-1": |
|
64 |
domain: "sa-east-1.compute.internal" |
|
65 |
"ap-south-1": |
|
66 |
domain: "ap-south-1.compute.internal" |
|
67 |
Resources: |
|
68 |
Vpc: |
|
69 |
Type: "AWS::EC2::VPC" |
|
70 |
Properties: |
|
71 |
CidrBlock: "192.199.0.0/16" |
|
72 |
EnableDnsSupport: true |
|
73 |
EnableDnsHostnames: true |
|
74 |
Tags: |
|
75 |
- Key: Name |
|
76 |
Value: "{{vpcid_name_tag}}" |
|
77 |
- Key: Hostlication |
|
78 |
Value: |
|
79 |
Ref: "AWS::StackId" |
|
80 |
VpcInternetGateway: |
|
81 |
Type: "AWS::EC2::InternetGateway" |
|
82 |
VpcGA: |
|
83 |
Type: "AWS::EC2::VPCGatewayAttachment" |
|
84 |
Properties: |
|
85 |
InternetGatewayId: |
|
86 |
Ref: VpcInternetGateway |
|
87 |
VpcId: |
|
88 |
Ref: Vpc |
|
89 |
VpcRouteTable: |
|
90 |
Type: "AWS::EC2::RouteTable" |
|
91 |
Properties: |
|
92 |
VpcId: |
|
93 |
Ref: Vpc |
|
94 |
VPCRouteInternetGateway: |
|
95 |
DependsOn: VpcGA |
|
96 |
Type: "AWS::EC2::Route" |
|
97 |
Properties: |
|
98 |
GatewayId: |
|
99 |
Ref: VpcInternetGateway |
|
100 |
DestinationCidrBlock: "0.0.0.0/0" |
|
101 |
RouteTableId: |
|
102 |
Ref: VpcRouteTable |
|
103 |
PublicSubnet: |
|
104 |
Type: "AWS::EC2::Subnet" |
|
105 |
DependsOn: |
|
106 |
- Vpc |
|
107 |
Properties: |
|
108 |
CidrBlock: "192.199.0.0/24" |
|
109 |
Tags: |
|
110 |
- Key: Name |
|
111 |
Value: "{{project_tag}}" |
|
112 |
- Key: Hostlication |
|
113 |
Value: |
|
114 |
Ref: "AWS::StackId" |
|
115 |
MapPublicIpOnLaunch: true |
|
116 |
VpcId: |
|
117 |
Ref: Vpc |
|
118 |
PublicSubnetRTA: |
|
119 |
Type: "AWS::EC2::SubnetRouteTableAssociation" |
|
120 |
Properties: |
|
121 |
RouteTableId: |
|
122 |
Ref: VpcRouteTable |
|
123 |
SubnetId: |
|
124 |
Ref: PublicSubnet |
|
125 |
HostSG: |
|
126 |
Type: "AWS::EC2::SecurityGroup" |
|
127 |
Properties: |
|
128 |
GroupDescription: Host |
|
129 |
VpcId: |
|
130 |
Ref: Vpc |
|
131 |
Tags: |
|
132 |
- Key: Name |
|
133 |
Value: host_sg |
|
134 |
HostUDPPorts: |
|
135 |
Type: "AWS::EC2::SecurityGroupIngress" |
|
136 |
Properties: |
|
137 |
GroupId: |
|
138 |
"Fn::GetAtt": |
|
139 |
- HostSG |
|
140 |
- GroupId |
|
141 |
IpProtocol: udp |
|
142 |
FromPort: 0 |
|
143 |
ToPort: 65535 |
|
144 |
CidrIp: "0.0.0.0/0" |
|
145 |
HostTCPPorts: |
|
146 |
Type: "AWS::EC2::SecurityGroupIngress" |
|
147 |
Properties: |
|
148 |
GroupId: |
|
149 |
"Fn::GetAtt": |
|
150 |
- HostSG |
|
151 |
- GroupId |
|
152 |
IpProtocol: tcp |
|
153 |
FromPort: 0 |
|
154 |
ToPort: 65535 |
|
155 |
CidrIp: "0.0.0.0/0" |
|
156 |
zoneinternalidns: |
|
157 |
Type: "AWS::Route53::HostedZone" |
|
158 |
Properties: |
|
159 |
Name: "{{ zone_internal_dns }}" |
|
160 |
VPCs: |
|
161 |
- VPCId: |
|
162 |
Ref: Vpc |
|
163 |
VPCRegion: |
|
164 |
Ref: "AWS::Region" |
|
165 |
HostedZoneConfig: |
|
166 |
Comment: "Created By ansible agnostic deployer" |
|
167 |
BastionDNS: |
|
168 |
Type: "AWS::Route53::RecordSetGroup" |
|
169 |
DependsOn: |
|
170 |
- BastionEIP |
|
171 |
Properties: |
|
172 |
HostedZoneId: "{{HostedZoneId}}" |
|
173 |
RecordSets: |
|
174 |
- Name: "bastion.{{subdomain_base}}." |
|
175 |
Type: A |
|
176 |
TTL: 10 |
|
177 |
ResourceRecords: |
|
178 |
- "Fn::GetAtt": |
|
179 |
- Bastion |
|
180 |
- PublicIp |
|
181 |
Bastion: |
|
182 |
Type: "AWS::EC2::Instance" |
|
183 |
Properties: |
|
184 |
ImageId: |
|
185 |
"Fn::FindInMap": |
|
186 |
- RegionMapping |
|
187 |
- Ref: "AWS::Region" |
|
188 |
- RHELAMI |
|
189 |
InstanceType: "{{bastion_instance_type}}" |
|
190 |
KeyName: "{{key_name}}" |
|
191 |
SecurityGroupIds: |
|
192 |
- "Fn::GetAtt": |
|
193 |
- HostSG |
|
194 |
- GroupId |
|
195 |
SubnetId: |
|
196 |
Ref: PublicSubnet |
|
197 |
Tags: |
|
198 |
- Key: Name |
|
199 |
Value: bastion |
|
200 |
- Key: AnsibleGroup |
|
201 |
Value: bastions |
|
202 |
- Key: Project |
|
203 |
Value: "{{project_tag}}" |
|
204 |
- Key: "{{project_tag}}" |
|
205 |
Value: bastion |
|
206 |
- Key: internaldns |
|
207 |
Value: "bastion.{{chomped_zone_internal_dns}}" |
|
208 |
- Key: owner |
|
209 |
Value: "{{ email | default('unknown')}}" |
|
210 |
BastionEIP: |
|
211 |
Type: "AWS::EC2::EIP" |
|
212 |
DependsOn: |
|
213 |
- VpcGA |
|
214 |
Properties: |
|
215 |
InstanceId: |
|
216 |
Ref: Bastion |
|
217 |
BastionInternalDNS: |
|
218 |
Type: "AWS::Route53::RecordSetGroup" |
|
219 |
Properties: |
|
220 |
HostedZoneId: |
|
221 |
Ref: zoneinternalidns |
|
222 |
RecordSets: |
|
223 |
- Name: "bastion.{{zone_internal_dns}}" |
|
224 |
Type: A |
|
225 |
TTL: 10 |
|
226 |
ResourceRecords: |
|
227 |
- "Fn::GetAtt": |
|
228 |
- Bastion |
|
229 |
- PrivateIp |
60154a
|
230 |
|
bc1ba6
|
231 |
{% for instance in instances %} |
c72173
|
232 |
{% if instance['dns_loadbalancer']|d(false)|bool %} |
bc1ba6
|
233 |
{{instance['name']}}DNSLoadBalancer: |
S |
234 |
Type: "AWS::Route53::RecordSetGroup" |
c72173
|
235 |
DependsOn: |
dd4ff3
|
236 |
{% for c in range(1,(instance['count'] |int)+1) %} |
c72173
|
237 |
- {{instance['name']}}{{c}}EIP |
GC |
238 |
{% endfor %} |
bc1ba6
|
239 |
Properties: |
S |
240 |
HostedZoneId: {{HostedZoneId}} |
|
241 |
RecordSets: |
|
242 |
- Name: "{{instance['name']}}.{{subdomain_base}}." |
|
243 |
Type: A |
|
244 |
TTL: 900 |
|
245 |
ResourceRecords: |
|
246 |
{% for c in range(1,(instance['count'] |int)+1) %} |
|
247 |
{% set instancecount = loop %} |
|
248 |
- "Fn::GetAtt": |
|
249 |
- {{instance['name']}}{{loop.index}} |
|
250 |
- PublicIp |
|
251 |
{% endfor %} |
|
252 |
{% endif %} |
|
253 |
|
00ffb6
|
254 |
{% for c in range(1,(instance['count'] |int)+1) %} |
S |
255 |
{% set instancecount = loop %} |
|
256 |
#this is host {{instance['name']}}{{loop.index}} |
60154a
|
257 |
|
00ffb6
|
258 |
{{instance['name']}}{{loop.index}}: |
S |
259 |
Type: "AWS::EC2::Instance" |
|
260 |
Properties: |
|
261 |
ImageId: |
|
262 |
"Fn::FindInMap": |
|
263 |
- RegionMapping |
|
264 |
- Ref: "AWS::Region" |
c72173
|
265 |
- {{ instance['image_id'] | default('RHELAMI') }} |
60154a
|
266 |
|
00ffb6
|
267 |
InstanceType: "{{instance['flavor'][cloud_provider]}}" |
S |
268 |
KeyName: "{{instance['key_name'] | default(key_name)}}" |
|
269 |
{% if instance['UserData'] is defined %} |
|
270 |
{{instance['UserData']}} |
|
271 |
{% endif %} |
|
272 |
SecurityGroupIds: |
|
273 |
- "Fn::GetAtt": |
|
274 |
- HostSG |
|
275 |
- GroupId |
|
276 |
SubnetId: |
|
277 |
Ref: PublicSubnet |
|
278 |
Tags: |
|
279 |
- Key: Name |
|
280 |
Value: {{instance['name']}}{{instancecount.index}} |
c72173
|
281 |
- Key: internaldns |
GC |
282 |
Value: {{instance['name']}}{{loop.index}}.{{chomped_zone_internal_dns}} |
e67c0e
|
283 |
- Key: "owner" |
GC |
284 |
Value: "{{ email | default('unknownuser') }}" |
c72173
|
285 |
- Key: "Project" |
GC |
286 |
Value: "{{project_tag}}" |
|
287 |
- Key: "{{project_tag}}" |
|
288 |
Value: "{{ instance['name'] }}" |
00ffb6
|
289 |
{% for tag in instance['tags'] %} |
S |
290 |
- Key: {{tag['key']}} |
|
291 |
Value: {{tag['value']}} |
|
292 |
{% endfor %} |
|
293 |
BlockDeviceMappings: |
|
294 |
- DeviceName: "/dev/sda1" |
|
295 |
Ebs: |
|
296 |
VolumeSize: 50 |
|
297 |
- DeviceName: "/dev/xvdb" |
|
298 |
Ebs: |
|
299 |
VolumeType: gp2 |
|
300 |
VolumeSize: 20 |
|
301 |
{{instance['name']}}{{loop.index}}InternalDNS: |
|
302 |
Type: "AWS::Route53::RecordSetGroup" |
|
303 |
Properties: |
|
304 |
HostedZoneId: |
|
305 |
Ref: zoneinternalidns |
|
306 |
RecordSets: |
|
307 |
- Name: "{{instance['name']}}{{loop.index}}.{{zone_internal_dns}}" |
|
308 |
Type: A |
|
309 |
TTL: 10 |
|
310 |
ResourceRecords: |
|
311 |
- "Fn::GetAtt": |
|
312 |
- {{instance['name']}}{{loop.index}} |
|
313 |
- PrivateIp |
|
314 |
{% if instance['public_dns'] %} |
|
315 |
{{instance['name']}}{{loop.index}}EIP: |
|
316 |
Type: "AWS::EC2::EIP" |
|
317 |
DependsOn: |
|
318 |
- VpcGA |
|
319 |
Properties: |
|
320 |
InstanceId: |
|
321 |
Ref: {{instance['name']}}{{loop.index}} |
|
322 |
{{instance['name']}}{{loop.index}}PubliclDNS: |
|
323 |
Type: "AWS::Route53::RecordSetGroup" |
|
324 |
DependsOn: |
|
325 |
- {{instance['name']}}{{loop.index}}EIP |
|
326 |
Properties: |
|
327 |
HostedZoneId: {{HostedZoneId}} |
|
328 |
RecordSets: |
|
329 |
- Name: "{{instance['name']}}{{loop.index}}.{{subdomain_base}}." |
|
330 |
Type: A |
|
331 |
TTL: 10 |
|
332 |
ResourceRecords: |
|
333 |
- "Fn::GetAtt": |
|
334 |
- {{instance['name']}}{{loop.index}} |
|
335 |
- PublicIp |
|
336 |
{% endif %} |
60154a
|
337 |
|
00ffb6
|
338 |
{% endfor %} |
S |
339 |
{% endfor %} |