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 |
"vm-prefix": "[concat(resourceGroup().name, '-vm-')]", |
20 |
"nic-prefix": "[concat(resourceGroup().name, '-nic-')]", |
21 |
"names": [ |
22 |
"alpha", |
23 |
"beta", |
24 |
"gamma", |
25 |
"delta", |
26 |
"epsilon", |
27 |
"zeta", |
28 |
"eta", |
29 |
"theta", |
30 |
"iota", |
31 |
"kappa", |
32 |
"lambda", |
33 |
"mu", |
34 |
"nu", |
35 |
"xi", |
36 |
"omicron", |
37 |
"pi", |
38 |
"rho", |
39 |
"sigma", |
40 |
"tau", |
41 |
"upsilon", |
42 |
"phi", |
43 |
"chi", |
44 |
"psi", |
45 |
"omega" |
46 |
], |
47 |
"vm-size": "Standard_DS2_v2", |
48 |
"vnet-address-space": "10.16.0.0/12", |
49 |
"vnet-subnet01-octet": 17 |
50 |
}, |
51 |
"resources": [ |
52 |
{ |
53 |
"comments": "", |
54 |
"type": "Microsoft.Network/publicIPAddresses", |
55 |
"name": "[concat(variables('ip-prefix'), variables('names')[0])]", |
56 |
"apiVersion": "2017-03-01", |
57 |
"location": "[resourceGroup().location]", |
58 |
"properties": { |
59 |
"publicIPAllocationMethod": "Dynamic", |
60 |
"idleTimeoutInMinutes": 4, |
61 |
"dnsSettings": { |
62 |
"domainNameLabel": "[concat(variables('unique-prefix'), '-', variables('names')[0])]" |
63 |
} |
64 |
}, |
65 |
"resources": [], |
66 |
"dependsOn": [] |
67 |
}, |
68 |
{ |
69 |
"comments": "", |
70 |
"type": "Microsoft.Compute/virtualMachines", |
71 |
"name": "[concat(variables('vm-prefix'), variables('names')[0])]", |
72 |
"apiVersion": "2016-04-30-preview", |
73 |
"location": "[resourceGroup().location]", |
74 |
"properties": { |
75 |
"hardwareProfile": { |
76 |
"vmSize": "[variables('vm-size')]" |
77 |
}, |
78 |
"storageProfile": { |
79 |
"imageReference": { |
80 |
"publisher": "OpenLogic", |
81 |
"offer": "CentOS", |
82 |
"sku": "7.2", |
83 |
"version": "latest" |
84 |
}, |
85 |
"osDisk": { |
86 |
"name": "[concat(variables('vm-prefix'), variables('names')[0], '-boot')]", |
87 |
"createOption": "FromImage", |
88 |
"vhd": { |
89 |
"uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storage-name')), '2015-06-15').primaryEndpoints.blob, 'vhds/', variables('names')[0], '-boot.vhd')]" |
90 |
}, |
91 |
"caching": "ReadWrite" |
92 |
}, |
93 |
"dataDisks": [ |
94 |
{ |
95 |
"name": "[concat(concat(variables('vm-prefix'), variables('names')[0]), '-disk01')]", |
96 |
"diskSizeGB": 127, |
97 |
"lun": 0, |
98 |
"vhd": { |
99 |
"uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storage-name')), '2015-06-15').primaryEndpoints.blob, 'vhds/', variables('names')[0], '-data01.vhd')]" |
100 |
}, |
101 |
"createOption": "Empty" |
102 |
}, |
103 |
{ |
104 |
"name": "[concat(concat(variables('vm-prefix'), variables('names')[0]), '-disk02')]", |
105 |
"diskSizeGB": 127, |
106 |
"lun": 1, |
107 |
"vhd": { |
108 |
"uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storage-name')), '2015-06-15').primaryEndpoints.blob, 'vhds/', variables('names')[0], '-data02.vhd')]" |
109 |
}, |
110 |
"createOption": "Empty" |
111 |
}, |
112 |
{ |
113 |
"name": "[concat(concat(variables('vm-prefix'), variables('names')[0]), '-disk03')]", |
114 |
"diskSizeGB": 127, |
115 |
"lun": 2, |
116 |
"vhd": { |
117 |
"uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storage-name')), '2015-06-15').primaryEndpoints.blob, 'vhds/', variables('names')[0], '-data03.vhd')]" |
118 |
}, |
119 |
"createOption": "Empty" |
120 |
}, |
121 |
{ |
122 |
"name": "[concat(concat(variables('vm-prefix'), variables('names')[0]), '-disk04')]", |
123 |
"diskSizeGB": 127, |
124 |
"lun": 43, |
125 |
"vhd": { |
126 |
"uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storage-name')), '2015-06-15').primaryEndpoints.blob, 'vhds/', variables('names')[0], '-data04.vhd')]" |
127 |
}, |
128 |
"createOption": "Empty" |
129 |
} |
130 |
] |
131 |
}, |
132 |
"osProfile": { |
133 |
"computerName": "[concat(variables('vm-prefix'), variables('names')[0])]", |
134 |
"adminUsername": "[parameters('admin-username')]", |
135 |
"linuxConfiguration": { |
136 |
"disablePasswordAuthentication": true, |
137 |
"ssh": { |
138 |
"publicKeys": [ |
139 |
{ |
140 |
"path": "[variables('ssh-keypath')]", |
141 |
"keyData": "[parameters('ssh-public-key')]" |
142 |
} |
143 |
] |
144 |
} |
145 |
} |
146 |
}, |
147 |
"networkProfile": { |
148 |
"networkInterfaces": [ |
149 |
{ |
150 |
"id": "[resourceId('Microsoft.Network/networkInterfaces', concat(variables('nic-prefix'), variables('names')[0]))]" |
151 |
} |
152 |
] |
153 |
} |
154 |
}, |
155 |
"resources": [], |
156 |
"dependsOn": [ |
157 |
"[resourceId('Microsoft.Storage/storageAccounts', variables('storage-name'))]", |
158 |
"[resourceId('Microsoft.Network/networkInterfaces', concat(variables('nic-prefix'), variables('names')[0]))]" |
159 |
] |
160 |
}, |
161 |
{ |
162 |
"type": "Microsoft.Compute/virtualMachines/extensions", |
163 |
"name": "[concat(variables('vm-prefix'), variables('names')[0], '/script')]", |
164 |
"apiVersion": "2015-05-01-preview", |
165 |
"location": "[resourceGroup().location]", |
166 |
"dependsOn": [ |
167 |
"[concat(variables('vm-prefix'), variables('names')[0])]" |
168 |
], |
169 |
"properties": { |
170 |
"publisher": "Microsoft.Azure.Extensions", |
171 |
"type": "CustomScript", |
172 |
"typeHandlerVersion": "2.0", |
173 |
"autoUpgradeMinorVersion": true, |
174 |
"settings": { |
175 |
"fileUris": [ |
176 |
"https://linux.azure.david.betz.space/raw/raid-crypto-lvm/install.sh" |
177 |
], |
178 |
"commandToExecute": "sh install.sh" |
179 |
} |
180 |
} |
181 |
}, |
182 |
{ |
183 |
"comments": "", |
184 |
"type": "Microsoft.Network/networkInterfaces", |
185 |
"name": "[concat(variables('nic-prefix'), variables('names')[0])]", |
186 |
"apiVersion": "2017-03-01", |
187 |
"location": "[resourceGroup().location]", |
188 |
"properties": { |
189 |
"ipConfigurations": [ |
190 |
{ |
191 |
"name": "ifconfig1", |
192 |
"properties": { |
193 |
"privateIPAllocationMethod": "Dynamic", |
194 |
"publicIPAddress": { |
195 |
"id": "[resourceId('Microsoft.Network/publicIPAddresses', concat(variables('ip-prefix'), variables('names')[0]))]" |
196 |
}, |
197 |
"subnet": { |
198 |
"id": "[concat(resourceId('Microsoft.Network/virtualNetworks', variables('vnet-name')), '/subnets/subnet01')]" |
199 |
} |
200 |
} |
201 |
} |
202 |
], |
203 |
"dnsSettings": { |
204 |
"dnsServers": [] |
205 |
}, |
206 |
"enableIPForwarding": false, |
207 |
"networkSecurityGroup": { |
208 |
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', concat(variables('nsg-prefix'), variables('names')[0]))]" |
209 |
} |
210 |
}, |
211 |
"resources": [], |
212 |
"dependsOn": [ |
213 |
"[resourceId('Microsoft.Network/publicIPAddresses', concat(variables('ip-prefix'), variables('names')[0]))]", |
214 |
"[resourceId('Microsoft.Network/virtualNetworks', variables('vnet-name'))]", |
215 |
"[resourceId('Microsoft.Network/networkSecurityGroups', concat(variables('nsg-prefix'), variables('names')[0]))]" |
216 |
] |
217 |
}, |
218 |
{ |
219 |
"comments": "", |
220 |
"type": "Microsoft.Network/virtualNetworks", |
221 |
"name": "[variables('vnet-name')]", |
222 |
"apiVersion": "2017-03-01", |
223 |
"location": "[resourceGroup().location]", |
224 |
"properties": { |
225 |
"addressSpace": { |
226 |
"addressPrefixes": [ |
227 |
"[variables('vnet-address-space')]" |
228 |
] |
229 |
}, |
230 |
"subnets": [ |
231 |
{ |
232 |
"name": "subnet01", |
233 |
"properties": { |
234 |
"addressPrefix": "[concat('10.', variables('vnet-subnet01-octet'), '.0.0/16')]" |
235 |
} |
236 |
} |
237 |
] |
238 |
}, |
239 |
"resources": [], |
240 |
"dependsOn": [] |
241 |
}, |
242 |
{ |
243 |
"comments": "", |
244 |
"type": "Microsoft.Network/networkSecurityGroups", |
245 |
"name": "[concat(variables('nsg-prefix'), variables('names')[0])]", |
246 |
"apiVersion": "2017-03-01", |
247 |
"location": "[resourceGroup().location]", |
248 |
"properties": { |
249 |
"securityRules": [ |
250 |
{ |
251 |
"name": "default-allow-ssh", |
252 |
"properties": { |
253 |
"protocol": "Tcp", |
254 |
"sourcePortRange": "*", |
255 |
"destinationPortRange": "22", |
256 |
"sourceAddressPrefix": "*", |
257 |
"destinationAddressPrefix": "*", |
258 |
"access": "Allow", |
259 |
"priority": 1000, |
260 |
"direction": "Inbound" |
261 |
} |
262 |
} |
263 |
] |
264 |
}, |
265 |
"resources": [], |
266 |
"dependsOn": [] |
267 |
}, |
268 |
{ |
269 |
"comments": "", |
270 |
"type": "Microsoft.Storage/storageAccounts", |
271 |
"sku": { |
272 |
"name": "Standard_LRS", |
273 |
"tier": "Standard" |
274 |
}, |
275 |
"kind": "Storage", |
276 |
"name": "[variables('storage-name')]", |
277 |
"apiVersion": "2016-01-01", |
278 |
"location": "[resourceGroup().location]", |
279 |
"tags": {}, |
280 |
"properties": {}, |
281 |
"resources": [], |
282 |
"dependsOn": [] |
283 |
} |
284 |
], |
285 |
"outputs": { |
286 |
"sshCommand": { |
287 |
"type": "string", |
288 |
"value": "[concat('ssh ', variables('unique-prefix'), '-', variables('names')[0], '.', resourceGroup().location, '.cloudapp.azure.com')]" |
289 |
} |
290 |
} |
291 |
} |
292 |
|
293 |
|
294 |
|
295 |
|