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