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