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