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