mariadb/azuredeploy.json

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