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