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