wombat-cli 0.3.4 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -0
- data/.travis.yml +27 -0
- data/CHANGELOG.md +15 -1
- data/Gemfile +3 -0
- data/README.md +2 -2
- data/Rakefile +25 -0
- data/bin/wombat +1 -1
- data/generator_files/cookbooks/automate/metadata.rb +1 -1
- data/generator_files/cookbooks/automate/recipes/update-users.rb +1 -1
- data/generator_files/cookbooks/chef_server/recipes/default.rb +24 -11
- data/generator_files/cookbooks/workstation/.kitchen.ec2.yml +2 -1
- data/generator_files/cookbooks/workstation/metadata.rb +1 -1
- data/generator_files/cookbooks/workstation/recipes/default.rb +1 -2
- data/generator_files/cookbooks/workstation/templates/default/ise_profile.ps1.erb +2 -2
- data/generator_files/cookbooks/workstation/test/integration/default/workstation_spec.rb +4 -4
- data/generator_files/packer/automate.json +129 -107
- data/generator_files/packer/build-node.json +134 -112
- data/generator_files/packer/chef-server.json +130 -108
- data/generator_files/packer/compliance.json +126 -104
- data/generator_files/packer/infranodes-windows.json +136 -97
- data/generator_files/packer/infranodes.json +127 -106
- data/generator_files/packer/workstation.json +134 -95
- data/generator_files/templates/arm.json.erb +576 -0
- data/generator_files/wombat.yml +6 -2
- data/lib/wombat/aws.rb +67 -0
- data/lib/wombat/build.rb +273 -184
- data/lib/wombat/cli.rb +182 -147
- data/lib/wombat/common.rb +228 -220
- data/lib/wombat/crypto.rb +65 -0
- data/lib/wombat/delete.rb +48 -18
- data/lib/wombat/deploy.rb +147 -34
- data/lib/wombat/init.rb +21 -19
- data/lib/wombat/latest.rb +27 -0
- data/lib/wombat/output.rb +31 -30
- data/lib/wombat/update.rb +13 -10
- data/lib/wombat/version.rb +1 -1
- data/spec/functional/common_spec.rb +26 -0
- data/spec/spec_helper.rb +103 -0
- data/spec/unit/common_spec.rb +116 -0
- data/wombat-cli.gemspec +2 -1
- metadata +36 -11
- /data/generator_files/cookbooks/workstation/test/fixtures/cookbooks/mock_data/files/{delivery.crt → automate.crt} +0 -0
- /data/generator_files/cookbooks/workstation/test/fixtures/cookbooks/mock_data/files/{delivery.key → automate.key} +0 -0
- /data/generator_files/cookbooks/workstation/test/fixtures/cookbooks/mock_data/files/{chef-server.crt → chef.crt} +0 -0
- /data/generator_files/cookbooks/workstation/test/fixtures/cookbooks/mock_data/files/{chef-server.key → chef.key} +0 -0
@@ -0,0 +1,576 @@
|
|
1
|
+
{
|
2
|
+
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
3
|
+
"contentVersion": "1.0.0.1",
|
4
|
+
"parameters": {
|
5
|
+
|
6
|
+
"demoName": {
|
7
|
+
"metadata": {
|
8
|
+
"description": "Name of the customer or organization"
|
9
|
+
},
|
10
|
+
"type": "string",
|
11
|
+
"defaultValue": "<%= @demo %>"
|
12
|
+
},
|
13
|
+
|
14
|
+
"storageAccountName": {
|
15
|
+
"type": "string",
|
16
|
+
"metadata": {
|
17
|
+
"description": "Name of the storage account that should be used to store the machine disks"
|
18
|
+
},
|
19
|
+
"defaultValue": "<%= @storage_account %>"
|
20
|
+
},
|
21
|
+
|
22
|
+
"adminPassword": {
|
23
|
+
"type": "string",
|
24
|
+
"metadata": {
|
25
|
+
"description": "Password associated with the specified user"
|
26
|
+
},
|
27
|
+
"defaultValue": "<%= @password %>"
|
28
|
+
},
|
29
|
+
|
30
|
+
"shortUniqueLength": {
|
31
|
+
"type": "int",
|
32
|
+
"metadata": {
|
33
|
+
"description": "Number of characters to be take from the unique string to make a short unique string"
|
34
|
+
},
|
35
|
+
"defaultValue": 4
|
36
|
+
}
|
37
|
+
|
38
|
+
},
|
39
|
+
"variables": {
|
40
|
+
|
41
|
+
"unique": "[uniqueString(subscription().subscriptionId, resourceGroup().id, deployment().name)]",
|
42
|
+
"uniqueShort": "[substring(variables('unique'), 0, parameters('shortUniqueLength'))]",
|
43
|
+
|
44
|
+
"location": "[resourceGroup().location]",
|
45
|
+
|
46
|
+
"sa": {
|
47
|
+
"name": "[parameters('storageAccountName')]",
|
48
|
+
"container": "vhds",
|
49
|
+
"type": "Standard_LRS"
|
50
|
+
},
|
51
|
+
|
52
|
+
"network": {
|
53
|
+
"virtual": {
|
54
|
+
"name": "ChefAutomate-VNET",
|
55
|
+
"addressPrefix": "172.31.54.0/24"
|
56
|
+
},
|
57
|
+
"subnet": {
|
58
|
+
"name": "ChefAutomate-Subnet",
|
59
|
+
"addressPrefix": "172.31.54.0/24"
|
60
|
+
},
|
61
|
+
"ipAddresses": {
|
62
|
+
"chef": {
|
63
|
+
"internal": {
|
64
|
+
"address": "172.31.54.10",
|
65
|
+
"allocationMethod": "static"
|
66
|
+
}
|
67
|
+
},
|
68
|
+
"automate": {
|
69
|
+
"internal": {
|
70
|
+
"address": "172.31.54.11",
|
71
|
+
"allocationMethod": "static"
|
72
|
+
}
|
73
|
+
},
|
74
|
+
"compliance": {
|
75
|
+
"internal": {
|
76
|
+
"address": "172.31.54.12",
|
77
|
+
"allocationMethod": "static"
|
78
|
+
}
|
79
|
+
},
|
80
|
+
"workstation": {
|
81
|
+
"internal": {
|
82
|
+
"addressPrefix": "172.31.54.",
|
83
|
+
"allocationMethod": "static"
|
84
|
+
},
|
85
|
+
"external": {
|
86
|
+
"domainNameLabel": "[concat('ws-', variables('uniqueShort'))]",
|
87
|
+
"allocationMethod": "dynamic"
|
88
|
+
}
|
89
|
+
},
|
90
|
+
"buildnode": {
|
91
|
+
"internal": {
|
92
|
+
"addressPrefix": "172.31.54.",
|
93
|
+
"allocationMethod": "static"
|
94
|
+
}
|
95
|
+
},
|
96
|
+
"infranode": {
|
97
|
+
"internal": {
|
98
|
+
"addressPrefix": "172.31.54.",
|
99
|
+
"allocationMethod": "static"
|
100
|
+
}
|
101
|
+
}
|
102
|
+
}
|
103
|
+
},
|
104
|
+
|
105
|
+
"customData": "#cloud-config\nmanage_etc_hosts: true\n\npackage_update: false"
|
106
|
+
},
|
107
|
+
"resources": [
|
108
|
+
|
109
|
+
{
|
110
|
+
"type": "Microsoft.Network/virtualNetworks",
|
111
|
+
"name": "[variables('network').virtual.name]",
|
112
|
+
"apiVersion": "2015-06-15",
|
113
|
+
"location": "[variables('location')]",
|
114
|
+
"properties": {
|
115
|
+
"addressSpace": {
|
116
|
+
"addressPrefixes": [
|
117
|
+
"[variables('network').virtual.addressPrefix]"
|
118
|
+
]
|
119
|
+
},
|
120
|
+
"subnets": [
|
121
|
+
{
|
122
|
+
"name": "[variables('network').subnet.name]",
|
123
|
+
"properties": {
|
124
|
+
"addressPrefix": "[variables('network').subnet.addressPrefix]"
|
125
|
+
}
|
126
|
+
}
|
127
|
+
]
|
128
|
+
}
|
129
|
+
},
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
<% 1.upto(@workstations) do |i| -%>
|
134
|
+
|
135
|
+
{
|
136
|
+
"type": "Microsoft.Network/publicIPAddresses",
|
137
|
+
"name": "Workstation-<%= i.to_s %>-PublicIPAddress",
|
138
|
+
"apiVersion": "2015-06-15",
|
139
|
+
"location": "[variables('location')]",
|
140
|
+
"properties": {
|
141
|
+
"publicIPAllocationMethod": "[variables('network').ipAddresses.workstation.external.allocationMethod]",
|
142
|
+
"dnsSettings": {
|
143
|
+
"domainNameLabel": "[concat(variables('network').ipAddresses.workstation.external.domainNameLabel, '-', '<%= i.to_s %>')]"
|
144
|
+
}
|
145
|
+
}
|
146
|
+
},
|
147
|
+
|
148
|
+
{
|
149
|
+
"type": "Microsoft.Network/networkInterfaces",
|
150
|
+
"name": "Workstation-<%= i.to_s %>-NIC",
|
151
|
+
"apiVersion": "2015-06-15",
|
152
|
+
"location": "[variables('location')]",
|
153
|
+
"dependsOn": [
|
154
|
+
"[concat('Microsoft.Network/virtualNetworks/', variables('network').virtual.name)]",
|
155
|
+
"Microsoft.Network/publicIPAddresses/Workstation-<%= i.to_s %>-PublicIPAddress"
|
156
|
+
],
|
157
|
+
"properties": {
|
158
|
+
"ipConfigurations": [
|
159
|
+
{
|
160
|
+
"name": "ipconfig1",
|
161
|
+
"properties": {
|
162
|
+
"privateIPAllocationMethod": "[variables('network').ipAddresses.workstation.internal.allocationMethod]",
|
163
|
+
"privateIPAddress": "[concat(variables('network').ipAddresses.workstation.internal.addressPrefix, '<%= 200 + i %>')]",
|
164
|
+
"publicIPAddress": {
|
165
|
+
"id": "[resourceId('Microsoft.Network/publicIPAddresses', 'Workstation-<%= i.to_s %>-PublicIPAddress')]"
|
166
|
+
},
|
167
|
+
"subnet": {
|
168
|
+
"id": "[concat(resourceId('Microsoft.Network/virtualNetworks', variables('network').virtual.name), '/subnets/', variables('network').subnet.name)]"
|
169
|
+
}
|
170
|
+
}
|
171
|
+
}
|
172
|
+
]
|
173
|
+
}
|
174
|
+
},
|
175
|
+
|
176
|
+
{
|
177
|
+
"type": "Microsoft.Compute/virtualMachines",
|
178
|
+
"name": "Workstation-<%= i.to_s %>-VM",
|
179
|
+
"apiVersion": "2015-06-15",
|
180
|
+
"location": "[variables('location')]",
|
181
|
+
"dependsOn": [
|
182
|
+
"Microsoft.Network/networkInterfaces/Workstation-<%= i.to_s %>-NIC"
|
183
|
+
],
|
184
|
+
"tags": {
|
185
|
+
"name": "[concat(parameters('demoName'), ' Workstation <%= i.to_s %>')]"
|
186
|
+
},
|
187
|
+
"properties": {
|
188
|
+
"hardwareProfile": {
|
189
|
+
"vmSize": "Standard_DS2_v2"
|
190
|
+
},
|
191
|
+
"osProfile": {
|
192
|
+
"computerName": "[concat(variables('network').ipAddresses.workstation.external.domainNameLabel, '-', '<%= i.to_s %>')]",
|
193
|
+
"adminUsername": "azure",
|
194
|
+
"adminPassword": "[parameters('adminPassword')]"
|
195
|
+
},
|
196
|
+
"storageProfile": {
|
197
|
+
"osDisk": {
|
198
|
+
"name": "workstation-<%= i.to_s %>-osdisk",
|
199
|
+
"osType": "windows",
|
200
|
+
"createOption": "FromImage",
|
201
|
+
"caching": "ReadWrite",
|
202
|
+
"image": {
|
203
|
+
"uri": "<%= @workstation_ami[i] %>"
|
204
|
+
},
|
205
|
+
"vhd": {
|
206
|
+
"uri": "[concat('https://', variables('sa').name, '.blob.core.windows.net/', variables('sa').container, '/workstation-<%= i.to_s %>-osdisk.vhd')]"
|
207
|
+
}
|
208
|
+
}
|
209
|
+
},
|
210
|
+
"networkProfile": {
|
211
|
+
"networkInterfaces": [
|
212
|
+
{
|
213
|
+
"id": "[resourceId('Microsoft.Network/networkInterfaces', 'Workstation-<%= i.to_s %>-NIC')]"
|
214
|
+
}
|
215
|
+
]
|
216
|
+
}
|
217
|
+
}
|
218
|
+
},
|
219
|
+
|
220
|
+
<% end %>
|
221
|
+
|
222
|
+
<% 1.upto(@build_nodes) do |i| -%>
|
223
|
+
|
224
|
+
{
|
225
|
+
"type": "Microsoft.Network/networkInterfaces",
|
226
|
+
"name": "BuildNode-<%= i.to_s %>-NIC",
|
227
|
+
"apiVersion": "2015-06-15",
|
228
|
+
"location": "[variables('location')]",
|
229
|
+
"dependsOn": [
|
230
|
+
"[concat('Microsoft.Network/virtualNetworks/', variables('network').virtual.name)]"
|
231
|
+
],
|
232
|
+
"properties": {
|
233
|
+
"ipConfigurations": [
|
234
|
+
{
|
235
|
+
"name": "ipconfig1",
|
236
|
+
"properties": {
|
237
|
+
"privateIPAllocationMethod": "[variables('network').ipAddresses.buildnode.internal.allocationMethod]",
|
238
|
+
"privateIPAddress": "[concat(variables('network').ipAddresses.buildnode.internal.addressPrefix, '<%= 50 + i %>')]",
|
239
|
+
"subnet": {
|
240
|
+
"id": "[concat(resourceId('Microsoft.Network/virtualNetworks', variables('network').virtual.name), '/subnets/', variables('network').subnet.name)]"
|
241
|
+
}
|
242
|
+
}
|
243
|
+
}
|
244
|
+
]
|
245
|
+
}
|
246
|
+
},
|
247
|
+
|
248
|
+
{
|
249
|
+
"type": "Microsoft.Compute/virtualMachines",
|
250
|
+
"name": "BuildNode-<%= i.to_s %>-VM",
|
251
|
+
"apiVersion": "2015-06-15",
|
252
|
+
"location": "[variables('location')]",
|
253
|
+
"dependsOn": [
|
254
|
+
"Microsoft.Network/networkInterfaces/BuildNode-<%= i.to_s %>-NIC"
|
255
|
+
],
|
256
|
+
"tags": {
|
257
|
+
"name": "[concat(parameters('demoName'), ' Build Node <%= i.to_s %>')]"
|
258
|
+
},
|
259
|
+
"properties": {
|
260
|
+
"hardwareProfile": {
|
261
|
+
"vmSize": "Standard_DS2_v2"
|
262
|
+
},
|
263
|
+
"osProfile": {
|
264
|
+
"computerName": "build-node-<%= i.to_s %>",
|
265
|
+
"adminUsername": "ubuntu",
|
266
|
+
"adminPassword": "[parameters('adminPassword')]"
|
267
|
+
},
|
268
|
+
"storageProfile": {
|
269
|
+
"osDisk": {
|
270
|
+
"name": "buildnode-<%= i.to_s %>-osdisk",
|
271
|
+
"osType": "linux",
|
272
|
+
"createOption": "FromImage",
|
273
|
+
"caching": "ReadWrite",
|
274
|
+
"image": {
|
275
|
+
"uri": "<%= @build_node_ami[i] %>"
|
276
|
+
},
|
277
|
+
"vhd": {
|
278
|
+
"uri": "[concat('https://', variables('sa').name, '.blob.core.windows.net/', variables('sa').container, '/buildnode-<%= i.to_s %>-osdisk.vhd')]"
|
279
|
+
}
|
280
|
+
}
|
281
|
+
},
|
282
|
+
"networkProfile": {
|
283
|
+
"networkInterfaces": [
|
284
|
+
{
|
285
|
+
"id": "[resourceId('Microsoft.Network/networkInterfaces', 'BuildNode-<%= i.to_s %>-NIC')]"
|
286
|
+
}
|
287
|
+
]
|
288
|
+
}
|
289
|
+
}
|
290
|
+
},
|
291
|
+
|
292
|
+
<% end %>
|
293
|
+
|
294
|
+
<% @infra.sort.each do |name, _uri| -%>
|
295
|
+
|
296
|
+
{
|
297
|
+
"type": "Microsoft.Network/networkInterfaces",
|
298
|
+
"name": "InfraNode-<%= name %>-NIC",
|
299
|
+
"apiVersion": "2015-06-15",
|
300
|
+
"location": "[variables('location')]",
|
301
|
+
"dependsOn": [
|
302
|
+
"[concat('Microsoft.Network/virtualNetworks/', variables('network').virtual.name)]"
|
303
|
+
],
|
304
|
+
"properties": {
|
305
|
+
"ipConfigurations": [
|
306
|
+
{
|
307
|
+
"name": "ipconfig1",
|
308
|
+
"properties": {
|
309
|
+
"privateIPAllocationMethod": "[variables('network').ipAddresses.infranode.internal.allocationMethod]",
|
310
|
+
"privateIPAddress": "[concat(variables('network').ipAddresses.infranode.internal.addressPrefix, '<%= 101 + @infra.keys.find_index(name) %>')]",
|
311
|
+
"subnet": {
|
312
|
+
"id": "[concat(resourceId('Microsoft.Network/virtualNetworks', variables('network').virtual.name), '/subnets/', variables('network').subnet.name)]"
|
313
|
+
}
|
314
|
+
}
|
315
|
+
}
|
316
|
+
]
|
317
|
+
}
|
318
|
+
},
|
319
|
+
|
320
|
+
{
|
321
|
+
"type": "Microsoft.Compute/virtualMachines",
|
322
|
+
"name": "InfraNode-<%= name %>-VM",
|
323
|
+
"apiVersion": "2015-06-15",
|
324
|
+
"location": "[variables('location')]",
|
325
|
+
"dependsOn": [
|
326
|
+
"Microsoft.Network/networkInterfaces/InfraNode-<%= name %>-NIC"
|
327
|
+
],
|
328
|
+
"tags": {
|
329
|
+
"name": "[concat(parameters('demoName'), ' Infra Node - <%= name %>')]"
|
330
|
+
},
|
331
|
+
"properties": {
|
332
|
+
"hardwareProfile": {
|
333
|
+
"vmSize": "Standard_DS2_v2"
|
334
|
+
},
|
335
|
+
"osProfile": {
|
336
|
+
"computerName": "<%= name %>",
|
337
|
+
"adminUsername": "ubuntu",
|
338
|
+
"adminPassword": "[parameters('adminPassword')]"
|
339
|
+
},
|
340
|
+
"storageProfile": {
|
341
|
+
"osDisk": {
|
342
|
+
"name": "infranode-<%= name %>-osdisk",
|
343
|
+
"osType": "linux",
|
344
|
+
"createOption": "FromImage",
|
345
|
+
"caching": "ReadWrite",
|
346
|
+
"image": {
|
347
|
+
"uri": "<%= _uri %>"
|
348
|
+
},
|
349
|
+
"vhd": {
|
350
|
+
"uri": "[concat('https://', variables('sa').name, '.blob.core.windows.net/', variables('sa').container, '/infranode-<%= name %>-osdisk.vhd')]"
|
351
|
+
}
|
352
|
+
}
|
353
|
+
},
|
354
|
+
"networkProfile": {
|
355
|
+
"networkInterfaces": [
|
356
|
+
{
|
357
|
+
"id": "[resourceId('Microsoft.Network/networkInterfaces', 'InfraNode-<%= name %>-NIC')]"
|
358
|
+
}
|
359
|
+
]
|
360
|
+
}
|
361
|
+
}
|
362
|
+
},
|
363
|
+
|
364
|
+
<% end %>
|
365
|
+
|
366
|
+
{
|
367
|
+
"type": "Microsoft.Network/networkInterfaces",
|
368
|
+
"name": "ChefServer-NIC",
|
369
|
+
"apiVersion": "2015-06-15",
|
370
|
+
"location": "[variables('location')]",
|
371
|
+
"dependsOn": [
|
372
|
+
"[concat('Microsoft.Network/virtualNetworks/', variables('network').virtual.name)]"
|
373
|
+
],
|
374
|
+
"properties": {
|
375
|
+
"ipConfigurations": [
|
376
|
+
{
|
377
|
+
"name": "ipconfig1",
|
378
|
+
"properties": {
|
379
|
+
"privateIPAllocationMethod": "[variables('network').ipAddresses.chef.internal.allocationMethod]",
|
380
|
+
"privateIPAddress": "[variables('network').ipAddresses.chef.internal.address]",
|
381
|
+
"subnet": {
|
382
|
+
"id": "[concat(resourceId('Microsoft.Network/virtualNetworks', variables('network').virtual.name), '/subnets/', variables('network').subnet.name)]"
|
383
|
+
}
|
384
|
+
}
|
385
|
+
}
|
386
|
+
]
|
387
|
+
}
|
388
|
+
},
|
389
|
+
|
390
|
+
{
|
391
|
+
"type": "Microsoft.Compute/virtualMachines",
|
392
|
+
"name": "ChefServer-VM",
|
393
|
+
"apiVersion": "2015-06-15",
|
394
|
+
"location": "[variables('location')]",
|
395
|
+
"dependsOn": [
|
396
|
+
"Microsoft.Network/networkInterfaces/ChefServer-NIC"
|
397
|
+
],
|
398
|
+
"tags": {
|
399
|
+
"name": "[concat(parameters('demoName'), ' Chef Server')]"
|
400
|
+
},
|
401
|
+
"properties": {
|
402
|
+
"hardwareProfile": {
|
403
|
+
"vmSize": "Standard_F4s"
|
404
|
+
},
|
405
|
+
"osProfile": {
|
406
|
+
"computerName": "[concat('chef-', variables('uniqueShort'))]",
|
407
|
+
"customData": "[base64(concat(variables('customData'), '\n\nruncmd:\n - hostnamectl set-hostname chef\n - chef-server-ctl reconfigure'))]",
|
408
|
+
"adminUsername": "ubuntu",
|
409
|
+
"adminPassword": "[parameters('adminPassword')]"
|
410
|
+
},
|
411
|
+
"storageProfile": {
|
412
|
+
"osDisk": {
|
413
|
+
"name": "chefserver-osdisk",
|
414
|
+
"osType": "linux",
|
415
|
+
"createOption": "FromImage",
|
416
|
+
"caching": "ReadWrite",
|
417
|
+
"image": {
|
418
|
+
"uri": "<%= @chef_server_uri %>"
|
419
|
+
},
|
420
|
+
"vhd": {
|
421
|
+
"uri": "[concat('https://', variables('sa').name, '.blob.core.windows.net/', variables('sa').container, '/chefserver-osdisk.vhd')]"
|
422
|
+
}
|
423
|
+
}
|
424
|
+
},
|
425
|
+
"networkProfile": {
|
426
|
+
"networkInterfaces": [
|
427
|
+
{
|
428
|
+
"id": "[resourceId('Microsoft.Network/networkInterfaces', 'ChefServer-NIC')]"
|
429
|
+
}
|
430
|
+
]
|
431
|
+
}
|
432
|
+
}
|
433
|
+
},
|
434
|
+
|
435
|
+
{
|
436
|
+
"type": "Microsoft.Network/networkInterfaces",
|
437
|
+
"name": "AutomateServer-NIC",
|
438
|
+
"apiVersion": "2015-06-15",
|
439
|
+
"location": "[variables('location')]",
|
440
|
+
"dependsOn": [
|
441
|
+
"[concat('Microsoft.Network/virtualNetworks/', variables('network').virtual.name)]"
|
442
|
+
],
|
443
|
+
"properties": {
|
444
|
+
"ipConfigurations": [
|
445
|
+
{
|
446
|
+
"name": "ipconfig1",
|
447
|
+
"properties": {
|
448
|
+
"privateIPAllocationMethod": "[variables('network').ipAddresses.automate.internal.allocationMethod]",
|
449
|
+
"privateIPAddress": "[variables('network').ipAddresses.automate.internal.address]",
|
450
|
+
"subnet": {
|
451
|
+
"id": "[concat(resourceId('Microsoft.Network/virtualNetworks', variables('network').virtual.name), '/subnets/', variables('network').subnet.name)]"
|
452
|
+
}
|
453
|
+
}
|
454
|
+
}
|
455
|
+
]
|
456
|
+
}
|
457
|
+
},
|
458
|
+
|
459
|
+
{
|
460
|
+
"type": "Microsoft.Compute/virtualMachines",
|
461
|
+
"name": "AutomateServer-VM",
|
462
|
+
"apiVersion": "2015-06-15",
|
463
|
+
"location": "[variables('location')]",
|
464
|
+
"dependsOn": [
|
465
|
+
"Microsoft.Network/networkInterfaces/AutomateServer-NIC"
|
466
|
+
],
|
467
|
+
"tags": {
|
468
|
+
"name": "[concat(parameters('demoName'), ' Automate Server')]"
|
469
|
+
},
|
470
|
+
"properties": {
|
471
|
+
"hardwareProfile": {
|
472
|
+
"vmSize": "Standard_F4s"
|
473
|
+
},
|
474
|
+
"osProfile": {
|
475
|
+
"computerName": "[concat('chef-', variables('uniqueShort'))]",
|
476
|
+
"customData": "[base64(concat(variables('customData'), '\n\nruncmd:\n - hostnamectl set-hostname automate\n - chef-server-ctl reconfigure'))]",
|
477
|
+
"adminUsername": "ubuntu",
|
478
|
+
"adminPassword": "[parameters('adminPassword')]"
|
479
|
+
},
|
480
|
+
"storageProfile": {
|
481
|
+
"osDisk": {
|
482
|
+
"name": "automateserver-osdisk",
|
483
|
+
"osType": "linux",
|
484
|
+
"createOption": "FromImage",
|
485
|
+
"caching": "ReadWrite",
|
486
|
+
"image": {
|
487
|
+
"uri": "<%= @automate_uri %>"
|
488
|
+
},
|
489
|
+
"vhd": {
|
490
|
+
"uri": "[concat('https://', variables('sa').name, '.blob.core.windows.net/', variables('sa').container, '/automate-osdisk.vhd')]"
|
491
|
+
}
|
492
|
+
}
|
493
|
+
},
|
494
|
+
"networkProfile": {
|
495
|
+
"networkInterfaces": [
|
496
|
+
{
|
497
|
+
"id": "[resourceId('Microsoft.Network/networkInterfaces', 'AutomateServer-NIC')]"
|
498
|
+
}
|
499
|
+
]
|
500
|
+
}
|
501
|
+
}
|
502
|
+
},
|
503
|
+
|
504
|
+
{
|
505
|
+
"type": "Microsoft.Network/networkInterfaces",
|
506
|
+
"name": "ComplianceServer-NIC",
|
507
|
+
"apiVersion": "2015-06-15",
|
508
|
+
"location": "[variables('location')]",
|
509
|
+
"dependsOn": [
|
510
|
+
"[concat('Microsoft.Network/virtualNetworks/', variables('network').virtual.name)]"
|
511
|
+
],
|
512
|
+
"properties": {
|
513
|
+
"ipConfigurations": [
|
514
|
+
{
|
515
|
+
"name": "ipconfig1",
|
516
|
+
"properties": {
|
517
|
+
"privateIPAllocationMethod": "[variables('network').ipAddresses.compliance.internal.allocationMethod]",
|
518
|
+
"privateIPAddress": "[variables('network').ipAddresses.compliance.internal.address]",
|
519
|
+
"subnet": {
|
520
|
+
"id": "[concat(resourceId('Microsoft.Network/virtualNetworks', variables('network').virtual.name), '/subnets/', variables('network').subnet.name)]"
|
521
|
+
}
|
522
|
+
}
|
523
|
+
}
|
524
|
+
]
|
525
|
+
}
|
526
|
+
},
|
527
|
+
|
528
|
+
{
|
529
|
+
"type": "Microsoft.Compute/virtualMachines",
|
530
|
+
"name": "ComplianceServer-VM",
|
531
|
+
"apiVersion": "2015-06-15",
|
532
|
+
"location": "[variables('location')]",
|
533
|
+
"dependsOn": [
|
534
|
+
"Microsoft.Network/networkInterfaces/ComplianceServer-NIC"
|
535
|
+
],
|
536
|
+
"tags": {
|
537
|
+
"name": "[concat(parameters('demoName'), ' Compliance Server')]"
|
538
|
+
},
|
539
|
+
"properties": {
|
540
|
+
"hardwareProfile": {
|
541
|
+
"vmSize": "Standard_F4s"
|
542
|
+
},
|
543
|
+
"osProfile": {
|
544
|
+
"computerName": "[concat('chef-', variables('uniqueShort'))]",
|
545
|
+
"customData": "[base64(concat(variables('customData'), '\n\nruncmd:\n - hostnamectl set-hostname compliance\n - chef-server-ctl reconfigure'))]",
|
546
|
+
"adminUsername": "ubuntu",
|
547
|
+
"adminPassword": "[parameters('adminPassword')]"
|
548
|
+
},
|
549
|
+
"storageProfile": {
|
550
|
+
"osDisk": {
|
551
|
+
"name": "complianceserver-osdisk",
|
552
|
+
"osType": "linux",
|
553
|
+
"createOption": "FromImage",
|
554
|
+
"caching": "ReadWrite",
|
555
|
+
"image": {
|
556
|
+
"uri": "<%= @compliance_uri %>"
|
557
|
+
},
|
558
|
+
"vhd": {
|
559
|
+
"uri": "[concat('https://', variables('sa').name, '.blob.core.windows.net/', variables('sa').container, '/compliance-osdisk.vhd')]"
|
560
|
+
}
|
561
|
+
}
|
562
|
+
},
|
563
|
+
"networkProfile": {
|
564
|
+
"networkInterfaces": [
|
565
|
+
{
|
566
|
+
"id": "[resourceId('Microsoft.Network/networkInterfaces', 'ComplianceServer-NIC')]"
|
567
|
+
}
|
568
|
+
]
|
569
|
+
}
|
570
|
+
}
|
571
|
+
}
|
572
|
+
],
|
573
|
+
"outputs": {
|
574
|
+
|
575
|
+
}
|
576
|
+
}
|
data/generator_files/wombat.yml
CHANGED
@@ -10,6 +10,7 @@ certs: ['automate', 'chef', 'compliance']
|
|
10
10
|
ttl: 6
|
11
11
|
linux: ubuntu
|
12
12
|
version: 0.2.1
|
13
|
+
owner:
|
13
14
|
products:
|
14
15
|
chef: stable-latest
|
15
16
|
chef-server: stable-latest
|
@@ -54,10 +55,13 @@ aws:
|
|
54
55
|
# This optional key presumes these IAM roles are already created
|
55
56
|
# and are only applied to workstations currently
|
56
57
|
# iam_roles: ['iam_role', 'iam_roles_buddy']
|
57
|
-
|
58
|
+
source_image:
|
58
59
|
ubuntu: ami-8e0b9499
|
59
|
-
windows: ami-
|
60
|
+
windows: ami-1c7ad77c
|
60
61
|
centos: ami-6d1c2007
|
62
|
+
azure:
|
63
|
+
location: eastus
|
64
|
+
storage_account:
|
61
65
|
gce:
|
62
66
|
zone: us-east1-b
|
63
67
|
project: wombat-gce
|
data/lib/wombat/aws.rb
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
require "wombat/common"
|
2
|
+
require "aws-sdk"
|
3
|
+
|
4
|
+
# http://docs.aws.amazon.com/sdkforruby/api/Aws/EC2/Client.html#describe_images-instance_method
|
5
|
+
# https://github.com/test-kitchen/kitchen-ec2/blob/aa8e7f2cf9bfbb10fa4057f3297c2a20dc079f7b/lib/kitchen/driver/aws/standard_platform.rb
|
6
|
+
# https://github.com/test-kitchen/kitchen-ec2/blob/aa8e7f2cf9bfbb10fa4057f3297c2a20dc079f7b/lib/kitchen/driver/aws/standard_platform/ubuntu.rb
|
7
|
+
|
8
|
+
module Wombat
|
9
|
+
module Aws
|
10
|
+
include Wombat::Common
|
11
|
+
|
12
|
+
def find_latest_amis
|
13
|
+
client = ::Aws::EC2::Client.new(:region => wombat["aws"]["region"])
|
14
|
+
# static list of images
|
15
|
+
desc_hash = {
|
16
|
+
"ubuntu-16.04" => ["ubuntu/images/hvm-ssd/ubuntu-xenial-16.04-amd64-server-*", "099720109477"],
|
17
|
+
"ubuntu-14.04" => ["ubuntu/images/hvm-ssd/ubuntu-trusty-14.04-amd64-server-*", "099720109477"],
|
18
|
+
"centos-7" => ["CentOS Linux 7 x86_64 HVM EBS*", "679593333241"],
|
19
|
+
"windows-2012r2" => ["Windows_Server-2012-R2_RTM-English-64Bit-Base-*", "801119661308"]
|
20
|
+
}
|
21
|
+
desc_hash.each do |k, v|
|
22
|
+
resp = client.describe_images({
|
23
|
+
dry_run: false,
|
24
|
+
filters: [
|
25
|
+
{
|
26
|
+
name: "name",
|
27
|
+
values: [v[0]],
|
28
|
+
},
|
29
|
+
{
|
30
|
+
name: "owner-id",
|
31
|
+
values: [v[1]],
|
32
|
+
},
|
33
|
+
],
|
34
|
+
})
|
35
|
+
images = sort_images(resp.images)
|
36
|
+
|
37
|
+
puts "#{k}: #{images[:image_id]}"
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def prefer(images, &block)
|
43
|
+
# Put the matching ones *before* the non-matching ones.
|
44
|
+
matching, non_matching = images.partition(&block)
|
45
|
+
matching + non_matching
|
46
|
+
end
|
47
|
+
|
48
|
+
def sort_images(images)
|
49
|
+
# P5: We prefer more recent images over older ones
|
50
|
+
images = images.sort_by(&:creation_date).reverse
|
51
|
+
# P4: We prefer x86_64 over i386 (if available)
|
52
|
+
images = prefer(images) { |image| image.architecture == :x86_64 }
|
53
|
+
# P3: We prefer gp2 (SSD) (if available)
|
54
|
+
images = prefer(images) do |image|
|
55
|
+
image.block_device_mappings.any? do |b|
|
56
|
+
b.device_name == image.root_device_name && b.ebs && b.ebs.volume_type == "gp2"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
# P2: We prefer ebs over instance_store (if available)
|
60
|
+
images = prefer(images) { |image| image.root_device_type == "ebs" }
|
61
|
+
# P1: We prefer hvm (the modern standard)
|
62
|
+
images = prefer(images) { |image| image.virtualization_type == "hvm" }
|
63
|
+
# Grab the image from the top of the stack
|
64
|
+
images.first
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|