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