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