mongodb/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 "dataDisks": [
94 {
95 "name": "[concat(variables('vm-prefix'), variables('names')[0], '-disk01')]",
96 "diskSizeGB": 127,
97 "lun": 0,
98 "vhd": {
99 "uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storage-name')), '2015-06-15').primaryEndpoints.blob, 'vhds/', variables('names')[0], '-data01.vhd')]"
100 },
101 "createOption": "Empty"
102 }
103 ]
104 },
105 "osProfile": {
106 "computerName": "[concat(variables('vm-prefix'), variables('names')[0])]",
107 "adminUsername": "[parameters('admin-username')]",
108 "linuxConfiguration": {
109 "disablePasswordAuthentication": true,
110 "ssh": {
111 "publicKeys": [
112 {
113 "path": "[variables('ssh-keypath')]",
114 "keyData": "[parameters('ssh-public-key')]"
115 }
116 ]
117 }
118 }
119 },
120 "networkProfile": {
121 "networkInterfaces": [
122 {
123 "id": "[resourceId('Microsoft.Network/networkInterfaces', concat(variables('nic-prefix'), variables('names')[0]))]"
124 }
125 ]
126 }
127 },
128 "resources": [],
129 "dependsOn": [
130 "[resourceId('Microsoft.Storage/storageAccounts', variables('storage-name'))]",
131 "[resourceId('Microsoft.Network/networkInterfaces', concat(variables('nic-prefix'), variables('names')[0]))]"
132 ]
133 },
134 {
135 "type": "Microsoft.Compute/virtualMachines/extensions",
136 "name": "[concat(variables('vm-prefix'), variables('names')[0], '/script')]",
137 "apiVersion": "2015-05-01-preview",
138 "location": "[resourceGroup().location]",
139 "dependsOn": [
140 "[concat(variables('vm-prefix'), variables('names')[0])]"
141 ],
142 "properties": {
143 "publisher": "Microsoft.Azure.Extensions",
144 "type": "CustomScript",
145 "typeHandlerVersion": "2.0",
146 "autoUpgradeMinorVersion": true,
147 "settings": {
148 "fileUris": [
149 "https://linux.azure.david.betz.space/raw/mongodb/install.sh"
150 ],
151 "commandToExecute": "sh install.sh"
152 }
153 }
154 },
155 {
156 "comments": "",
157 "type": "Microsoft.Network/networkInterfaces",
158 "name": "[concat(variables('nic-prefix'), variables('names')[0])]",
159 "apiVersion": "2017-03-01",
160 "location": "[resourceGroup().location]",
161 "properties": {
162 "ipConfigurations": [
163 {
164 "name": "ifconfig1",
165 "properties": {
166 "privateIPAllocationMethod": "Dynamic",
167 "publicIPAddress": {
168 "id": "[resourceId('Microsoft.Network/publicIPAddresses', concat(variables('ip-prefix'), variables('names')[0]))]"
169 },
170 "subnet": {
171 "id": "[concat(resourceId('Microsoft.Network/virtualNetworks', variables('vnet-name')), '/subnets/subnet01')]"
172 }
173 }
174 }
175 ],
176 "dnsSettings": {
177 "dnsServers": []
178 },
179 "enableIPForwarding": false,
180 "networkSecurityGroup": {
181 "id": "[resourceId('Microsoft.Network/networkSecurityGroups', concat(variables('nsg-prefix'), variables('names')[0]))]"
182 }
183 },
184 "resources": [],
185 "dependsOn": [
186 "[resourceId('Microsoft.Network/publicIPAddresses', concat(variables('ip-prefix'), variables('names')[0]))]",
187 "[resourceId('Microsoft.Network/virtualNetworks', variables('vnet-name'))]",
188 "[resourceId('Microsoft.Network/networkSecurityGroups', concat(variables('nsg-prefix'), variables('names')[0]))]"
189 ]
190 },
191 {
192 "comments": "",
193 "type": "Microsoft.Network/virtualNetworks",
194 "name": "[variables('vnet-name')]",
195 "apiVersion": "2017-03-01",
196 "location": "[resourceGroup().location]",
197 "properties": {
198 "addressSpace": {
199 "addressPrefixes": [
200 "[variables('vnet-address-space')]"
201 ]
202 },
203 "subnets": [
204 {
205 "name": "subnet01",
206 "properties": {
207 "addressPrefix": "[concat('10.', variables('vnet-subnet01-octet'), '.0.0/16')]"
208 }
209 }
210 ]
211 },
212 "resources": [],
213 "dependsOn": []
214 },
215 {
216 "comments": "",
217 "type": "Microsoft.Network/networkSecurityGroups",
218 "name": "[concat(variables('nsg-prefix'), variables('names')[0])]",
219 "apiVersion": "2017-03-01",
220 "location": "[resourceGroup().location]",
221 "properties": {
222 "securityRules": [
223 {
224 "name": "default-allow-ssh",
225 "properties": {
226 "protocol": "Tcp",
227 "sourcePortRange": "*",
228 "destinationPortRange": "22",
229 "sourceAddressPrefix": "*",
230 "destinationAddressPrefix": "*",
231 "access": "Allow",
232 "priority": 1000,
233 "direction": "Inbound"
234 }
235 },
236 {
237 "name": "mongo",
238 "properties": {
239 "protocol": "Tcp",
240 "sourcePortRange": "*",
241 "destinationPortRange": "27017",
242 "sourceAddressPrefix": "*",
243 "destinationAddressPrefix": "*",
244 "access": "Allow",
245 "priority": 1100,
246 "direction": "Inbound"
247 }
248 }
249 ]
250 },
251 "resources": [],
252 "dependsOn": []
253 },
254 {
255 "comments": "",
256 "type": "Microsoft.Storage/storageAccounts",
257 "sku": {
258 "name": "Standard_LRS",
259 "tier": "Standard"
260 },
261 "kind": "Storage",
262 "name": "[variables('storage-name')]",
263 "apiVersion": "2016-01-01",
264 "location": "[resourceGroup().location]",
265 "tags": {},
266 "properties": {},
267 "resources": [],
268 "dependsOn": []
269 }
270 ],
271 "outputs": {
272 "sshCommand": {
273 "type": "string",
274 "value": "[concat('ssh ', variables('unique-prefix'), '-', variables('names')[0], '.', resourceGroup().location, '.cloudapp.azure.com')]"
275 }
276 }
277 }
278
279
280
281