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