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