iscsi/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 "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": "[variables('vm-size')]"
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 },
98 "osProfile": {
99 "computerName": "[concat(variables('vm-prefix'), variables('names')[0])]",
100 "adminUsername": "[parameters('admin-username')]",
101 "linuxConfiguration": {
102 "disablePasswordAuthentication": true,
103 "ssh": {
104 "publicKeys": [
105 {
106 "path": "[variables('ssh-keypath')]",
107 "keyData": "[parameters('ssh-public-key')]"
108 }
109 ]
110 }
111 }
112 },
113 "networkProfile": {
114 "networkInterfaces": [
115 {
116 "id": "[resourceId('Microsoft.Network/networkInterfaces', concat(variables('nic-prefix'), variables('names')[0]))]"
117 }
118 ]
119 }
120 },
121 "resources": [],
122 "dependsOn": [
123 "[resourceId('Microsoft.Storage/storageAccounts', variables('storage-name'))]",
124 "[resourceId('Microsoft.Network/networkInterfaces', concat(variables('nic-prefix'), variables('names')[0]))]"
125 ]
126 },
127 {
128 "type": "Microsoft.Compute/virtualMachines/extensions",
129 "name": "[concat(variables('vm-prefix'), variables('names')[0], '/script')]",
130 "apiVersion": "2015-05-01-preview",
131 "location": "[resourceGroup().location]",
132 "dependsOn": [
133 "[concat(variables('vm-prefix'), variables('names')[0])]"
134 ],
135 "properties": {
136 "publisher": "Microsoft.Azure.Extensions",
137 "type": "CustomScript",
138 "typeHandlerVersion": "2.0",
139 "autoUpgradeMinorVersion": true,
140 "settings": {
141 "fileUris": [
142 "https://linux.azure.david.betz.space/raw/iscsi/client-install.sh"
143 ],
144 "commandToExecute": "sh client-install.sh"
145 }
146 }
147 },
148 {
149 "comments": "",
150 "type": "Microsoft.Network/publicIPAddresses",
151 "name": "[concat(variables('ip-prefix'), variables('names')[1])]",
152 "apiVersion": "2017-03-01",
153 "location": "[resourceGroup().location]",
154 "properties": {
155 "publicIPAllocationMethod": "Dynamic",
156 "idleTimeoutInMinutes": 4,
157 "dnsSettings": {
158 "domainNameLabel": "[concat(variables('unique-prefix'), '-', variables('names')[1])]"
159 }
160 },
161 "resources": [],
162 "dependsOn": []
163 },
164 {
165 "comments": "",
166 "type": "Microsoft.Compute/virtualMachines",
167 "name": "[concat(variables('vm-prefix'), variables('names')[1])]",
168 "apiVersion": "2016-04-30-preview",
169 "location": "[resourceGroup().location]",
170 "properties": {
171 "hardwareProfile": {
172 "vmSize": "[variables('vm-size')]"
173 },
174 "storageProfile": {
175 "imageReference": {
176 "publisher": "OpenLogic",
177 "offer": "CentOS",
178 "sku": "7.2",
179 "version": "latest"
180 },
181 "osDisk": {
182 "name": "[concat(concat(variables('vm-prefix'), variables('names')[1]), '-boot')]",
183 "createOption": "FromImage",
184 "vhd": {
185 "uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storage-name')), '2015-06-15').primaryEndpoints.blob, 'vhds/', variables('names')[1], '-boot.vhd')]"
186 },
187 "caching": "ReadWrite"
188 },
189 "dataDisks": [
190 {
191 "name": "[concat(variables('vm-prefix'), variables('names')[1], '-disk01')]",
192 "diskSizeGB": 127,
193 "lun": 0,
194 "vhd": {
195 "uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storage-name')), '2015-06-15').primaryEndpoints.blob, 'vhds/', variables('names')[1], '-data01.vhd')]"
196 },
197 "createOption": "Empty"
198 }
199 ]
200 },
201 "osProfile": {
202 "computerName": "[concat(variables('vm-prefix'), variables('names')[1])]",
203 "adminUsername": "[parameters('admin-username')]",
204 "linuxConfiguration": {
205 "disablePasswordAuthentication": true,
206 "ssh": {
207 "publicKeys": [
208 {
209 "path": "[variables('ssh-keypath')]",
210 "keyData": "[parameters('ssh-public-key')]"
211 }
212 ]
213 }
214 }
215 },
216 "networkProfile": {
217 "networkInterfaces": [
218 {
219 "id": "[resourceId('Microsoft.Network/networkInterfaces', concat(variables('nic-prefix'), variables('names')[1]))]"
220 }
221 ]
222 }
223 },
224 "resources": [],
225 "dependsOn": [
226 "[resourceId('Microsoft.Storage/storageAccounts', variables('storage-name'))]",
227 "[resourceId('Microsoft.Network/networkInterfaces', concat(variables('nic-prefix'), variables('names')[1]))]"
228 ]
229 },
230 {
231 "type": "Microsoft.Compute/virtualMachines/extensions",
232 "name": "[concat(variables('vm-prefix'), variables('names')[1], '/script')]",
233 "apiVersion": "2015-05-01-preview",
234 "location": "[resourceGroup().location]",
235 "dependsOn": [
236 "[concat(variables('vm-prefix'), variables('names')[1])]"
237 ],
238 "properties": {
239 "publisher": "Microsoft.Azure.Extensions",
240 "type": "CustomScript",
241 "typeHandlerVersion": "2.0",
242 "autoUpgradeMinorVersion": true,
243 "settings": {
244 "fileUris": [
245 "https://linux.azure.david.betz.space/raw/iscsi/service-install.sh"
246 ],
247 "commandToExecute": "sh service-install.sh"
248 }
249 }
250 },
251 {
252 "comments": "",
253 "type": "Microsoft.Network/networkInterfaces",
254 "name": "[concat(variables('nic-prefix'), variables('names')[0])]",
255 "apiVersion": "2017-03-01",
256 "location": "[resourceGroup().location]",
257 "properties": {
258 "ipConfigurations": [
259 {
260 "name": "ifconfig1",
261 "properties": {
262 "privateIPAllocationMethod": "Dynamic",
263 "publicIPAddress": {
264 "id": "[resourceId('Microsoft.Network/publicIPAddresses', concat(variables('ip-prefix'), variables('names')[0]))]"
265 },
266 "subnet": {
267 "id": "[concat(resourceId('Microsoft.Network/virtualNetworks', variables('vnet-name')), '/subnets/subnet01')]"
268 }
269 }
270 }
271 ],
272 "dnsSettings": {
273 "dnsServers": []
274 },
275 "enableIPForwarding": false,
276 "networkSecurityGroup": {
277 "id": "[resourceId('Microsoft.Network/networkSecurityGroups', concat(variables('nsg-prefix'), variables('names')[0]))]"
278 }
279 },
280 "resources": [],
281 "dependsOn": [
282 "[resourceId('Microsoft.Network/publicIPAddresses', concat(variables('ip-prefix'), variables('names')[0]))]",
283 "[resourceId('Microsoft.Network/virtualNetworks', variables('vnet-name'))]",
284 "[resourceId('Microsoft.Network/networkSecurityGroups', concat(variables('nsg-prefix'), variables('names')[0]))]"
285 ]
286 },
287 {
288 "comments": "",
289 "type": "Microsoft.Network/networkInterfaces",
290 "name": "[concat(variables('nic-prefix'), variables('names')[1])]",
291 "apiVersion": "2017-03-01",
292 "location": "[resourceGroup().location]",
293 "properties": {
294 "ipConfigurations": [
295 {
296 "name": "ifconfig1",
297 "properties": {
298 "privateIPAllocationMethod": "Dynamic",
299 "publicIPAddress": {
300 "id": "[resourceId('Microsoft.Network/publicIPAddresses', concat(variables('ip-prefix'), variables('names')[1]))]"
301 },
302 "subnet": {
303 "id": "[concat(resourceId('Microsoft.Network/virtualNetworks', variables('vnet-name')), '/subnets/subnet01')]"
304 }
305 }
306 }
307 ],
308 "dnsSettings": {
309 "dnsServers": []
310 },
311 "enableIPForwarding": false,
312 "networkSecurityGroup": {
313 "id": "[resourceId('Microsoft.Network/networkSecurityGroups', concat(variables('nsg-prefix'), variables('names')[1]))]"
314 }
315 },
316 "resources": [],
317 "dependsOn": [
318 "[resourceId('Microsoft.Network/publicIPAddresses', concat(variables('ip-prefix'), variables('names')[1]))]",
319 "[resourceId('Microsoft.Network/virtualNetworks', variables('vnet-name'))]",
320 "[resourceId('Microsoft.Network/networkSecurityGroups', concat(variables('nsg-prefix'), variables('names')[1]))]"
321 ]
322 },
323 {
324 "comments": "",
325 "type": "Microsoft.Network/virtualNetworks",
326 "name": "[variables('vnet-name')]",
327 "apiVersion": "2017-03-01",
328 "location": "[resourceGroup().location]",
329 "properties": {
330 "addressSpace": {
331 "addressPrefixes": [
332 "[variables('vnet-address-space')]"
333 ]
334 },
335 "subnets": [
336 {
337 "name": "subnet01",
338 "properties": {
339 "addressPrefix": "[concat('10.', variables('vnet-subnet01-octet'), '.0.0/16')]"
340 }
341 },
342 {
343 "name": "subnet02",
344 "properties": {
345 "addressPrefix": "[concat('10.', variables('vnet-subnet02-octet'), '.0.0/16')]"
346 }
347 }
348 ]
349 },
350 "resources": [],
351 "dependsOn": []
352 },
353 {
354 "comments": "",
355 "type": "Microsoft.Network/networkSecurityGroups",
356 "name": "[concat(variables('nsg-prefix'), variables('names')[0])]",
357 "apiVersion": "2017-03-01",
358 "location": "[resourceGroup().location]",
359 "properties": {
360 "securityRules": [
361 {
362 "name": "default-allow-ssh",
363 "properties": {
364 "protocol": "Tcp",
365 "sourcePortRange": "*",
366 "destinationPortRange": "22",
367 "sourceAddressPrefix": "*",
368 "destinationAddressPrefix": "*",
369 "access": "Allow",
370 "priority": 1000,
371 "direction": "Inbound"
372 }
373 }
374 ]
375 },
376 "resources": [],
377 "dependsOn": []
378 },
379 {
380 "comments": "",
381 "type": "Microsoft.Network/networkSecurityGroups",
382 "name": "[concat(variables('nsg-prefix'), variables('names')[1])]",
383 "apiVersion": "2017-03-01",
384 "location": "[resourceGroup().location]",
385 "properties": {
386 "securityRules": [
387 {
388 "name": "default-allow-ssh",
389 "properties": {
390 "protocol": "Tcp",
391 "sourcePortRange": "*",
392 "destinationPortRange": "22",
393 "sourceAddressPrefix": "*",
394 "destinationAddressPrefix": "*",
395 "access": "Allow",
396 "priority": 1000,
397 "direction": "Inbound"
398 }
399 },
400 {
401 "name": "mongo-non-default",
402 "properties": {
403 "protocol": "Tcp",
404 "sourcePortRange": "*",
405 "destinationPortRange": "3260",
406 "sourceAddressPrefix": "10.0.0.0/8",
407 "destinationAddressPrefix": "*",
408 "access": "Allow",
409 "priority": 1100,
410 "direction": "Inbound"
411 }
412 }
413 ]
414 },
415 "resources": [],
416 "dependsOn": []
417 },
418 {
419 "comments": "",
420 "type": "Microsoft.Storage/storageAccounts",
421 "sku": {
422 "name": "Standard_LRS",
423 "tier": "Standard"
424 },
425 "kind": "Storage",
426 "name": "[variables('storage-name')]",
427 "apiVersion": "2016-01-01",
428 "location": "[resourceGroup().location]",
429 "tags": {},
430 "properties": {},
431 "resources": [],
432 "dependsOn": []
433 }
434 ],
435 "outputs": {
436 "sshCommand": {
437 "type": "string",
438 "value": "[concat('ssh ', variables('unique-prefix'), '-', variables('names')[0], '.', resourceGroup().location, '.cloudapp.azure.com')]"
439 }
440 }
441 }
442
443
444
445