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