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