mariadb/azuredeploy.json

raw link view readme
1 {
2 "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
3 "contentVersion": "1.0.0.0",
4 "parameters": {
5 "admin-username": {
6 "type": "string"
7 },
8 "ssh-public-key": {
9 "type": "string"
10 }
11 },
12 "variables": {
13 "ssh-keypath": "[concat('/home/', parameters('admin-username'), '/.ssh/authorized_keys')]",
14 "unique-prefix": "[concat(replace(resourceGroup().name,'-',''), substring(uniquestring(resourceGroup().name), 0, 5))]",
15 "storage-name": "[variables('unique-prefix')]",
16 "vnet-name": "[concat(resourceGroup().name, '-vnet')]",
17 "ip-prefix": "[concat(resourceGroup().name, '-ip-')]",
18 "nsg-prefix": "[concat(resourceGroup().name, '-nsg')]",
19 "nic-prefix": "[concat(resourceGroup().name, '-nic-')]",
20 "access-nic-internal": "[concat(resourceGroup().name, '-access-nic-internal')]",
21 "access-nic-external": "[concat(resourceGroup().name, '-access-nic-external')]",
22 "vm-prefix": "[concat(resourceGroup().name, '-vm-')]",
23 "names": [
24 "alpha",
25 "beta",
26 "gamma",
27 "delta",
28 "epsilon",
29 "zeta",
30 "eta",
31 "theta",
32 "iota",
33 "kappa",
34 "lambda",
35 "mu",
36 "nu",
37 "xi",
38 "omicron",
39 "pi",
40 "rho",
41 "sigma",
42 "tau",
43 "upsilon",
44 "phi",
45 "chi",
46 "psi",
47 "omega"
48 ],
49 "private-vm-size": "Standard_DS1_v2",
50 "vnet-address-space": "10.16.0.0/12",
51 "vnet-subnet01-octet": 17,
52 "vnet-subnet02-octet": 18
53 },
54 "resources": [
55 {
56 "comments": "",
57 "type": "Microsoft.Network/publicIPAddresses",
58 "name": "[concat(variables('ip-prefix'), variables('names')[0])]",
59 "apiVersion": "2017-03-01",
60 "location": "[resourceGroup().location]",
61 "properties": {
62 "publicIPAllocationMethod": "Dynamic",
63 "idleTimeoutInMinutes": 4,
64 "dnsSettings": {
65 "domainNameLabel": "[concat(variables('unique-prefix'), '-', variables('names')[0])]"
66 }
67 },
68 "resources": [],
69 "dependsOn": []
70 },
71 {
72 "comments": "",
73 "type": "Microsoft.Compute/virtualMachines",
74 "name": "[concat(variables('vm-prefix'), variables('names')[0])]",
75 "apiVersion": "2016-04-30-preview",
76 "location": "[resourceGroup().location]",
77 "properties": {
78 "hardwareProfile": {
79 "vmSize": "Standard_DS2_v2"
80 },
81 "storageProfile": {
82 "imageReference": {
83 "publisher": "OpenLogic",
84 "offer": "CentOS",
85 "sku": "7.2",
86 "version": "latest"
87 },
88 "osDisk": {
89 "name": "[concat(variables('vm-prefix'), variables('names')[0], '-boot')]",
90 "createOption": "FromImage",
91 "vhd": {
92 "uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storage-name')), '2015-06-15').primaryEndpoints.blob, 'vhds/', variables('names')[0], '-boot.vhd')]"
93 },
94 "caching": "ReadWrite"
95 },
96 "dataDisks": [
97 {
98 "name": "[concat(variables('vm-prefix'), variables('names')[0], '-disk01')]",
99 "diskSizeGB": 127,
100 "lun": 0,
101 "vhd": {
102 "uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storage-name')), '2015-06-15').primaryEndpoints.blob, 'vhds/', variables('names')[0], '-data01.vhd')]"
103 },
104 "createOption": "Empty"
105 }
106 ]
107 },
108 "osProfile": {
109 "computerName": "[concat(variables('vm-prefix'), variables('names')[0])]",
110 "adminUsername": "[parameters('admin-username')]",
111 "linuxConfiguration": {
112 "disablePasswordAuthentication": true,
113 "ssh": {
114 "publicKeys": [
115 {
116 "path": "[variables('ssh-keypath')]",
117 "keyData": "[parameters('ssh-public-key')]"
118 }
119 ]
120 }
121 }
122 },
123 "networkProfile": {
124 "networkInterfaces": [
125 {
126 "id": "[resourceId('Microsoft.Network/networkInterfaces', concat(variables('nic-prefix'), variables('names')[0]))]",
127 "properties": {
128 "primary": true
129 }
130 },
131 {
132 "id": "[resourceId('Microsoft.Network/networkInterfaces', concat(variables('nic-prefix'), variables('names')[1]))]",
133 "properties": {
134 "primary": false
135 }
136 }
137 ]
138 }
139 },
140 "resources": [],
141 "dependsOn": [
142 "[resourceId('Microsoft.Storage/storageAccounts', variables('storage-name'))]",
143 "[resourceId('Microsoft.Network/networkInterfaces', concat(variables('nic-prefix'), variables('names')[0]))]",
144 "[resourceId('Microsoft.Network/networkInterfaces', concat(variables('nic-prefix'), variables('names')[0], '-', variables('names')[1]))]"
145 ]
146 },
147 {
148 "type": "Microsoft.Compute/virtualMachines/extensions",
149 "name": "[concat(variables('vm-prefix'), variables('names')[0], '/script')]",
150 "apiVersion": "2015-05-01-preview",
151 "location": "[resourceGroup().location]",
152 "dependsOn": [
153 "[concat(variables('vm-prefix'), variables('names')[0])]"
154 ],
155 "properties": {
156 "publisher": "Microsoft.Azure.Extensions",
157 "type": "CustomScript",
158 "typeHandlerVersion": "2.0",
159 "autoUpgradeMinorVersion": true,
160 "settings": {
161 "fileUris": [
162 "https://linux.azure.david.betz.space/raw/mariadb/client-install.sh"
163 ],
164 "commandToExecute": "sh client-install.sh"
165 }
166 }
167 },
168 {
169 "comments": "",
170 "type": "Microsoft.Compute/virtualMachines",
171 "name": "[concat(variables('vm-prefix'), variables('names')[1])]",
172 "apiVersion": "2016-04-30-preview",
173 "location": "[resourceGroup().location]",
174 "properties": {
175 "hardwareProfile": {
176 "vmSize": "[variables('private-vm-size')]"
177 },
178 "storageProfile": {
179 "imageReference": {
180 "publisher": "OpenLogic",
181 "offer": "CentOS",
182 "sku": "7.2",
183 "version": "latest"
184 },
185 "osDisk": {
186 "name": "[concat(concat(variables('vm-prefix'), variables('names')[1]), '-boot')]",
187 "createOption": "FromImage",
188 "vhd": {
189 "uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storage-name')), '2015-06-15').primaryEndpoints.blob, 'vhds/', variables('names')[1], '-boot.vhd')]"
190 },
191 "caching": "ReadWrite"
192 },
193 "dataDisks": [
194 {
195 "name": "[concat(variables('vm-prefix'), variables('names')[1], '-disk01')]",
196 "diskSizeGB": 127,
197 "lun": 0,
198 "vhd": {
199 "uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storage-name')), '2015-06-15').primaryEndpoints.blob, 'vhds/', variables('names')[1], '-data01.vhd')]"
200 },
201 "createOption": "Empty"
202 }
203 ]
204 },
205 "osProfile": {
206 "computerName": "[concat(variables('vm-prefix'), variables('names')[1])]",
207 "adminUsername": "[parameters('admin-username')]",
208 "linuxConfiguration": {
209 "disablePasswordAuthentication": true,
210 "ssh": {
211 "publicKeys": [
212 {
213 "path": "[variables('ssh-keypath')]",
214 "keyData": "[parameters('ssh-public-key')]"
215 }
216 ]
217 }
218 }
219 },
220 "networkProfile": {
221 "networkInterfaces": [
222 {
223 "id": "[resourceId('Microsoft.Network/networkInterfaces', concat(variables('nic-prefix'), variables('names')[1]))]"
224 }
225 ]
226 }
227 },
228 "resources": [],
229 "dependsOn": [
230 "[resourceId('Microsoft.Storage/storageAccounts', variables('storage-name'))]",
231 "[resourceId('Microsoft.Network/networkInterfaces', concat(variables('nic-prefix'), variables('names')[1]))]"
232 ]
233 },
234 {
235 "type": "Microsoft.Compute/virtualMachines/extensions",
236 "name": "[concat(variables('vm-prefix'), variables('names')[1], '/script')]",
237 "apiVersion": "2015-05-01-preview",
238 "location": "[resourceGroup().location]",
239 "dependsOn": [
240 "[concat(variables('vm-prefix'), variables('names')[1])]"
241 ],
242 "properties": {
243 "publisher": "Microsoft.Azure.Extensions",
244 "type": "CustomScript",
245 "typeHandlerVersion": "2.0",
246 "autoUpgradeMinorVersion": true,
247 "settings": {
248 "fileUris": [
249 "https://linux.azure.david.betz.space/raw/mariadb/service-install.sh"
250 ],
251 "commandToExecute": "sh service-install.sh"
252 }
253 }
254 },
255 {
256 "comments": "",
257 "type": "Microsoft.Network/networkInterfaces",
258 "name": "[concat(variables('nic-prefix'), variables('names')[0])]",
259 "apiVersion": "2017-03-01",
260 "location": "[resourceGroup().location]",
261 "properties": {
262 "ipConfigurations": [
263 {
264 "name": "ifconfig1",
265 "properties": {
266 "privateIPAllocationMethod": "Dynamic",
267 "publicIPAddress": {
268 "id": "[resourceId('Microsoft.Network/publicIPAddresses', concat(variables('ip-prefix'), variables('names')[0]))]"
269 },
270 "subnet": {
271 "id": "[concat(resourceId('Microsoft.Network/virtualNetworks', variables('vnet-name')), '/subnets/subnet01')]"
272 }
273 }
274 }
275 ],
276 "dnsSettings": {
277 "dnsServers": []
278 },
279 "enableIPForwarding": false,
280 "networkSecurityGroup": {
281 "id": "[resourceId('Microsoft.Network/networkSecurityGroups', concat(variables('nsg-prefix'), variables('names')[0]))]"
282 }
283 },
284 "resources": [],
285 "dependsOn": [
286 "[resourceId('Microsoft.Network/publicIPAddresses', concat(variables('ip-prefix'), variables('names')[0]))]",
287 "[resourceId('Microsoft.Network/virtualNetworks', variables('vnet-name'))]",
288 "[resourceId('Microsoft.Network/networkSecurityGroups', concat(variables('nsg-prefix'), variables('names')[0]))]"
289 ]
290 },
291 {
292 "comments": "",
293 "type": "Microsoft.Network/networkInterfaces",
294 "name": "[concat(variables('nic-prefix'), variables('names')[0], '-', variables('names')[1])]",
295 "apiVersion": "2017-03-01",
296 "location": "[resourceGroup().location]",
297 "properties": {
298 "ipConfigurations": [
299 {
300 "name": "ifconfig",
301 "properties": {
302 "privateIPAddress": "[concat('10.', variables('vnet-subnet02-octet'), '.0.5')]",
303 "privateIPAllocationMethod": "Static",
304 "subnet": {
305 "id": "[concat(resourceId('Microsoft.Network/virtualNetworks', variables('vnet-name')), '/subnets/subnet02')]"
306 }
307 }
308 }
309 ],
310 "dnsSettings": {
311 "dnsServers": []
312 },
313 "enableIPForwarding": false,
314 "networkSecurityGroup": {
315 "id": "[resourceId('Microsoft.Network/networkSecurityGroups', concat(variables('nsg-prefix'), variables('names')[0]))]"
316 }
317 },
318 "resources": [],
319 "dependsOn": [
320 "[resourceId('Microsoft.Network/virtualNetworks', variables('vnet-name'))]",
321 "[resourceId('Microsoft.Network/networkSecurityGroups', concat(variables('nsg-prefix'), variables('names')[0]))]"
322 ]
323 },
324 {
325 "comments": "",
326 "type": "Microsoft.Network/networkInterfaces",
327 "name": "[concat(variables('nic-prefix'), variables('names')[1])]",
328 "apiVersion": "2017-03-01",
329 "location": "[resourceGroup().location]",
330 "properties": {
331 "ipConfigurations": [
332 {
333 "name": "ifconfig",
334 "properties": {
335 "privateIPAddress": "[concat('10.', variables('vnet-subnet02-octet'), '.0.6')]",
336 "privateIPAllocationMethod": "Static",
337 "subnet": {
338 "id": "[concat(resourceId('Microsoft.Network/virtualNetworks', variables('vnet-name')), '/subnets/subnet02')]"
339 }
340 }
341 }
342 ],
343 "dnsSettings": {
344 "dnsServers": []
345 },
346 "enableIPForwarding": false,
347 "networkSecurityGroup": {
348 "id": "[resourceId('Microsoft.Network/networkSecurityGroups', concat(variables('nsg-prefix'), variables('names')[1]))]"
349 }
350 },
351 "resources": [],
352 "dependsOn": [
353 "[resourceId('Microsoft.Network/virtualNetworks', variables('vnet-name'))]",
354 "[resourceId('Microsoft.Network/networkSecurityGroups', concat(variables('nsg-prefix'), variables('names')[1]))]"
355 ]
356 },
357 {
358 "comments": "",
359 "type": "Microsoft.Network/virtualNetworks",
360 "name": "[variables('vnet-name')]",
361 "apiVersion": "2017-03-01",
362 "location": "[resourceGroup().location]",
363 "properties": {
364 "addressSpace": {
365 "addressPrefixes": [
366 "[variables('vnet-address-space')]"
367 ]
368 },
369 "subnets": [
370 {
371 "name": "subnet01",
372 "properties": {
373 "addressPrefix": "[concat('10.', variables('vnet-subnet01-octet'), '.0.0/16')]"
374 }
375 },
376 {
377 "name": "subnet02",
378 "properties": {
379 "addressPrefix": "[concat('10.', variables('vnet-subnet02-octet'), '.0.0/16')]"
380 }
381 }
382 ]
383 },
384 "resources": [],
385 "dependsOn": []
386 },
387 {
388 "comments": "",
389 "type": "Microsoft.Network/networkSecurityGroups",
390 "name": "[concat(variables('nsg-prefix'), variables('names')[0])]",
391 "apiVersion": "2017-03-01",
392 "location": "[resourceGroup().location]",
393 "properties": {
394 "securityRules": [
395 {
396 "name": "default-allow-ssh",
397 "properties": {
398 "protocol": "Tcp",
399 "sourcePortRange": "*",
400 "destinationPortRange": "22",
401 "sourceAddressPrefix": "*",
402 "destinationAddressPrefix": "*",
403 "access": "Allow",
404 "priority": 1000,
405 "direction": "Inbound"
406 }
407 },
408 {
409 "name": "http",
410 "properties": {
411 "protocol": "Tcp",
412 "sourcePortRange": "*",
413 "destinationPortRange": "80",
414 "sourceAddressPrefix": "*",
415 "destinationAddressPrefix": "*",
416 "access": "Allow",
417 "priority": 1100,
418 "direction": "Inbound"
419 }
420 },
421 {
422 "name": "https",
423 "properties": {
424 "protocol": "Tcp",
425 "sourcePortRange": "*",
426 "destinationPortRange": "443",
427 "sourceAddressPrefix": "*",
428 "destinationAddressPrefix": "*",
429 "access": "Allow",
430 "priority": 1200,
431 "direction": "Inbound"
432 }
433 }
434 ]
435 },
436 "resources": [],
437 "dependsOn": []
438 },
439 {
440 "comments": "",
441 "type": "Microsoft.Network/networkSecurityGroups",
442 "name": "[concat(variables('nsg-prefix'), variables('names')[1])]",
443 "apiVersion": "2017-03-01",
444 "location": "[resourceGroup().location]",
445 "properties": {
446 "securityRules": [
447 {
448 "name": "default-allow-ssh",
449 "properties": {
450 "protocol": "Tcp",
451 "sourcePortRange": "*",
452 "destinationPortRange": "22",
453 "sourceAddressPrefix": "*",
454 "destinationAddressPrefix": "*",
455 "access": "Allow",
456 "priority": 1000,
457 "direction": "Inbound"
458 }
459 },
460 {
461 "name": "mongo-non-default",
462 "properties": {
463 "protocol": "Tcp",
464 "sourcePortRange": "*",
465 "destinationPortRange": "3307",
466 "sourceAddressPrefix": "*",
467 "destinationAddressPrefix": "*",
468 "access": "Allow",
469 "priority": 1100,
470 "direction": "Inbound"
471 }
472 }
473 ]
474 },
475 "resources": [],
476 "dependsOn": []
477 },
478 {
479 "comments": "",
480 "type": "Microsoft.Storage/storageAccounts",
481 "sku": {
482 "name": "Standard_LRS",
483 "tier": "Standard"
484 },
485 "kind": "Storage",
486 "name": "[variables('storage-name')]",
487 "apiVersion": "2016-01-01",
488 "location": "[resourceGroup().location]",
489 "tags": {},
490 "properties": {},
491 "resources": [],
492 "dependsOn": []
493 }
494 ],
495 "outputs": {
496 "sshCommand": {
497 "type": "string",
498 "value": "[concat('ssh ', variables('unique-prefix'), '-', variables('names')[0], '.', resourceGroup().location, '.cloudapp.azure.com')]"
499 }
500 }
501 }
502
503
504
505