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