multi/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_DS2_v2_Promo",
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 "comments": "public ip",
148 "type": "Microsoft.Network/networkInterfaces",
149 "name": "[concat('nic-', variables('names')[copyindex()])]",
150 "copy": {
151 "name": "vm-count",
152 "count": "[parameters('vm-count')]"
153 },
154 "apiVersion": "2017-03-01",
155 "location": "[resourceGroup().location]",
156 "properties": {
157 "ipConfigurations": [
158 {
159 "name": "ifconfig1",
160 "properties": {
161 "privateIPAllocationMethod": "Dynamic",
162 "publicIPAddress": {
163 "id": "[resourceId('Microsoft.Network/publicIPAddresses', concat(variables('ip-prefix'), variables('names')[copyindex()]))]"
164 },
165 "subnet": {
166 "id": "[concat(resourceId('Microsoft.Network/virtualNetworks', variables('vnet-name')), '/subnets/subnet01')]"
167 }
168 }
169 }
170 ],
171 "dnsSettings": {
172 "dnsServers": []
173 },
174 "enableIPForwarding": false,
175 "networkSecurityGroup": {
176 "id": "[resourceId('Microsoft.Network/networkSecurityGroups', concat(variables('nsg-prefix'), variables('names')[copyindex()]))]"
177 }
178 },
179 "resources": [],
180 "dependsOn": [
181 "[resourceId('Microsoft.Network/publicIPAddresses', concat(variables('ip-prefix'), variables('names')[copyindex()]))]",
182 "[resourceId('Microsoft.Network/virtualNetworks', variables('vnet-name'))]",
183 "[resourceId('Microsoft.Network/networkSecurityGroups', concat(variables('nsg-prefix'), variables('names')[copyindex()]))]"
184 ]
185 },
186 {
187 "comments": "",
188 "type": "Microsoft.Network/virtualNetworks",
189 "name": "[variables('vnet-name')]",
190 "apiVersion": "2017-03-01",
191 "location": "[resourceGroup().location]",
192 "properties": {
193 "addressSpace": {
194 "addressPrefixes": [
195 "[variables('vnet-address-space')]"
196 ]
197 },
198 "subnets": [
199 {
200 "name": "subnet01",
201 "properties": {
202 "addressPrefix": "[concat('10.', variables('vnet-subnet01-octet'), '.0.0/16')]"
203 }
204 }
205 ]
206 },
207 "resources": [],
208 "dependsOn": []
209 },
210 {
211 "comments": "",
212 "type": "Microsoft.Network/networkSecurityGroups",
213 "name": "[concat(variables('nsg-prefix'), variables('names')[copyindex()])]",
214 "apiVersion": "2017-03-01",
215 "copy": {
216 "name": "vm-count",
217 "count": "[parameters('vm-count')]"
218 },
219 "location": "[resourceGroup().location]",
220 "properties": {
221 "securityRules": [
222 {
223 "name": "default-allow-ssh",
224 "properties": {
225 "protocol": "Tcp",
226 "sourcePortRange": "*",
227 "destinationPortRange": "22",
228 "sourceAddressPrefix": "*",
229 "destinationAddressPrefix": "*",
230 "access": "Allow",
231 "priority": 1000,
232 "direction": "Inbound"
233 }
234 }
235 ]
236 },
237 "resources": [],
238 "dependsOn": []
239 },
240 {
241 "comments": "",
242 "type": "Microsoft.Storage/storageAccounts",
243 "sku": {
244 "name": "Standard_LRS",
245 "tier": "Standard"
246 },
247 "kind": "Storage",
248 "name": "[variables('storage-name')]",
249 "apiVersion": "2016-01-01",
250 "location": "[resourceGroup().location]",
251 "tags": {},
252 "properties": {},
253 "resources": [],
254 "dependsOn": []
255 }
256 ],
257 "outputs": {
258 "sshCommand": {
259 "type": "string",
260 "value": "[concat('ssh ', variables('unique-prefix'), '-', variables('names')[0], '.', resourceGroup().location, '.cloudapp.azure.com')]"
261 }
262 }
263 }
264
265
266
267