elasticsearch-secure-nodes/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_DS1_v2",
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 "type": "Microsoft.Compute/virtualMachines/extensions",
148 "name": "[concat(variables('vm-prefix'), variables('names')[copyindex()], '/script')]",
149 "apiVersion": "2015-05-01-preview",
150 "location": "[resourceGroup().location]",
151 "copy": {
152 "name": "vm-count",
153 "count": "[parameters('vm-count')]"
154 },
155 "dependsOn": [
156 "[concat(variables('vm-prefix'), variables('names')[copyindex()])]"
157 ],
158 "properties": {
159 "publisher": "Microsoft.Azure.Extensions",
160 "type": "CustomScript",
161 "typeHandlerVersion": "2.0",
162 "autoUpgradeMinorVersion": true,
163 "settings": {
164 "fileUris": [
165 "https://linux.azure.david.betz.space/raw/elasticsearch-secure-nodes/install.sh"
166 ],
167 "commandToExecute": "[concat('sh install.sh ', variables('vnet-subnet01-octet'), ' ', parameters('vm-count'), ' ', variables('names')[copyindex()])]"
168 }
169 }
170 },
171 {
172 "comments": "public ip",
173 "type": "Microsoft.Network/networkInterfaces",
174 "name": "[concat('nic-', variables('names')[copyindex()])]",
175 "copy": {
176 "name": "vm-count",
177 "count": "[parameters('vm-count')]"
178 },
179 "apiVersion": "2017-03-01",
180 "location": "[resourceGroup().location]",
181 "properties": {
182 "ipConfigurations": [
183 {
184 "name": "ifconfig1",
185 "properties": {
186 "privateIPAllocationMethod": "Dynamic",
187 "publicIPAddress": {
188 "id": "[resourceId('Microsoft.Network/publicIPAddresses', concat(variables('ip-prefix'), variables('names')[copyindex()]))]"
189 },
190 "subnet": {
191 "id": "[concat(resourceId('Microsoft.Network/virtualNetworks', variables('vnet-name')), '/subnets/subnet01')]"
192 }
193 }
194 }
195 ],
196 "dnsSettings": {
197 "dnsServers": []
198 },
199 "enableIPForwarding": false,
200 "networkSecurityGroup": {
201 "id": "[resourceId('Microsoft.Network/networkSecurityGroups', concat(variables('nsg-prefix'), variables('names')[copyindex()]))]"
202 }
203 },
204 "resources": [],
205 "dependsOn": [
206 "[resourceId('Microsoft.Network/publicIPAddresses', concat(variables('ip-prefix'), variables('names')[copyindex()]))]",
207 "[resourceId('Microsoft.Network/virtualNetworks', variables('vnet-name'))]",
208 "[resourceId('Microsoft.Network/networkSecurityGroups', concat(variables('nsg-prefix'), variables('names')[copyindex()]))]"
209 ]
210 },
211 {
212 "comments": "",
213 "type": "Microsoft.Network/virtualNetworks",
214 "name": "[variables('vnet-name')]",
215 "apiVersion": "2017-03-01",
216 "location": "[resourceGroup().location]",
217 "properties": {
218 "addressSpace": {
219 "addressPrefixes": [
220 "[variables('vnet-address-space')]"
221 ]
222 },
223 "subnets": [
224 {
225 "name": "subnet01",
226 "properties": {
227 "addressPrefix": "[concat('10.', variables('vnet-subnet01-octet'), '.0.0/16')]"
228 }
229 }
230 ]
231 },
232 "resources": [],
233 "dependsOn": []
234 },
235 {
236 "comments": "",
237 "type": "Microsoft.Network/networkSecurityGroups",
238 "name": "[concat(variables('nsg-prefix'), variables('names')[copyindex()])]",
239 "apiVersion": "2017-03-01",
240 "copy": {
241 "name": "vm-count",
242 "count": "[parameters('vm-count')]"
243 },
244 "location": "[resourceGroup().location]",
245 "properties": {
246 "securityRules": [
247 {
248 "name": "default-allow-ssh",
249 "properties": {
250 "protocol": "Tcp",
251 "sourcePortRange": "*",
252 "destinationPortRange": "22",
253 "sourceAddressPrefix": "*",
254 "destinationAddressPrefix": "*",
255 "access": "Allow",
256 "priority": 1000,
257 "direction": "Inbound"
258 }
259 },
260 {
261 "name": "es",
262 "properties": {
263 "protocol": "Tcp",
264 "sourcePortRange": "*",
265 "destinationPortRange": "9200",
266 "sourceAddressPrefix": "*",
267 "destinationAddressPrefix": "*",
268 "access": "Allow",
269 "priority": 1100,
270 "direction": "Inbound"
271 }
272 }
273 ]
274 },
275 "resources": [],
276 "dependsOn": []
277 },
278 {
279 "comments": "",
280 "type": "Microsoft.Storage/storageAccounts",
281 "sku": {
282 "name": "Standard_LRS",
283 "tier": "Standard"
284 },
285 "kind": "Storage",
286 "name": "[variables('storage-name')]",
287 "apiVersion": "2016-01-01",
288 "location": "[resourceGroup().location]",
289 "tags": {},
290 "properties": {},
291 "resources": [],
292 "dependsOn": []
293 }
294 ],
295 "outputs": {
296 "sshCommand": {
297 "type": "string",
298 "value": "[concat('ssh ', variables('unique-prefix'), '-', variables('names')[0], '.', resourceGroup().location, '.cloudapp.azure.com')]"
299 }
300 }
301 }
302
303
304
305