forked from gbowerman/azure-myriad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmesos-vmss-simple-cluster.json
291 lines (291 loc) · 15.7 KB
/
mesos-vmss-simple-cluster.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01-preview/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"metadata": {
"eula": "http://docs.mesosphere.com/community-edition-eula/"
},
"parameters": {
"numberOfSlaves": {
"type": "int",
"metadata": {
"Description": "Number of slaves"
}
},
"sshKeyData": {
"type": "string",
"metadata": {
"Description": "Public key for SSH authentication"
}
},
"region": {
"type": "string",
"defaultValue": "West US",
"allowedValues": [
"East US",
"West US",
"West Europe",
"East Asia",
"Southeast Asia"
]
}
},
"variables": {
"imagePublisher": "CoreOS",
"imageOffer": "CoreOS",
"imageSku": "Stable",
"adminUsername": "core",
"authorizedSubnet": "Internet",
"vmStorageAccountContainerName": "vhd",
"subnet1Name": "Data",
"uniqueName": "[resourceGroup().name]",
"storageAccountName": "[concat(variables('uniqueName'), 'dcsan')]",
"virtualNetworkName": "[concat(variables('uniqueName'), 'dcvn')]",
"networkSecurityGroupName": "[concat(variables('uniqueName'), 'dcnsg')]",
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks',variables('virtualNetworkName'))]",
"subnet1Ref": "[concat(variables('vnetID'),'/subnets/',variables('subnet1Name'))]",
"sshKeyPath": "[concat('/home/',variables('adminUsername'),'/.ssh/authorized_keys')]",
"mesosQuorum": "1",
"subnet1Prefix": "10.0.0.0/24",
"addressPrefix": "10.0.0.0/16",
"vmSize": "Standard",
"computeApiVersion": "2016-03-30",
"networkApiVersion": "2016-03-30",
"storageApiVersion": "2015-06-15"
},
"resources": [
{
"type": "Microsoft.Storage/storageAccounts",
"name": "[variables('storageAccountName')]",
"apiVersion": "[variables('storageApiVersion')]",
"location": "[parameters('region')]",
"properties": {
"accountType": "Standard_LRS"
}
},
{
"apiVersion": "[variables('networkApiVersion')]",
"type": "Microsoft.Network/networkSecurityGroups",
"name": "[variables('networkSecurityGroupName')]",
"location": "[parameters('region')]",
"properties": {
"securityRules": [
{
"name": "Allow_Subnet",
"properties": {
"description": "Allow Subnet",
"protocol": "*",
"sourcePortRange": "*",
"destinationPortRange": "*",
"sourceAddressPrefix": "[variables('authorizedSubnet')]",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 100,
"direction": "Inbound"
}
}
]
}
},
{
"apiVersion": "[variables('networkApiVersion')]",
"type": "Microsoft.Network/virtualNetworks",
"name": "[variables('virtualNetworkName')]",
"location": "[parameters('region')]",
"dependsOn": [
"[concat('Microsoft.Network/networkSecurityGroups/', variables('networkSecurityGroupName'))]",
"[concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]"
],
"properties": {
"addressSpace": {
"addressPrefixes": [
"[variables('addressPrefix')]"
]
},
"subnets": [
{
"name": "[variables('subnet1Name')]",
"properties": {
"addressPrefix": "[variables('subnet1Prefix')]",
"networkSecurityGroup": {
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('networkSecurityGroupName'))]"
}
}
}
]
}
},
{
"type": "Microsoft.Network/publicIPAddresses",
"name": "masterPublicIP",
"location": "[parameters('region')]",
"apiVersion": "[variables('networkApiVersion')]",
"properties": {
"publicIPAllocationMethod": "Dynamic",
"dnsSettings": {
"domainNameLabel": "[concat('master-', variables('uniqueName'))]"
}
}
},
{
"type": "Microsoft.Compute/virtualMachineScaleSets",
"apiVersion": "[variables('computeApiVersion')]",
"name": "slaveset",
"location": "[parameters('region')]",
"dependsOn": [
"[concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]",
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]"
],
"sku": {
"name": "Standard_A2",
"tier": "[variables('vmSize')]",
"capacity": "[parameters('numberOfSlaves')]"
},
"properties": {
"overprovision": "true",
"upgradePolicy": {
"mode": "Manual"
},
"virtualMachineProfile": {
"storageProfile": {
"osDisk": {
"vhdContainers": [
"[concat('https://', variables('StorageAccountName'), '.blob.core.windows.net/', variables('vmStorageAccountContainerName'))]"
],
"name": "vmssosdisk",
"caching": "ReadOnly",
"createOption": "FromImage"
},
"imageReference": {
"publisher": "[variables('imagePublisher')]",
"offer": "[variables('imageOffer')]",
"sku": "[variables('imageSku')]",
"version": "latest"
}
},
"osProfile": {
"computerNamePrefix": "slave",
"adminUsername": "[variables('adminUsername')]",
"customData": "[base64(concat('#cloud-config\n\n', '{\"coreos\": {\"units\": [{\"command\": \"start\", \"content\": \"[Unit]\\nDescription=Mount /var/lib\\nBefore=dbus.service\\n[Mount]\\nWhat=/dev/sdb1\\nWhere=/var/lib\\nType=ext4\\n\", \"name\": \"var-lib.mount\"}, {\"command\": \"stop\", \"mask\": true, \"name\": \"systemd-resolved.service\"}, {\"command\": \"stop\", \"mask\": true, \"name\": \"etcd.service\"}, {\"command\": \"start\", \"content\": \"[Unit]\\nDescription=Write out dynamic config values\\n[Service]\\nType=oneshot\\nEnvironmentFile=/etc/environment\\n# Marathon depends on `hostname` resolution working\\nExecStart=/usr/bin/bash -c \\\"echo ${COREOS_PRIVATE_IPV4} $(hostname) > /etc/hosts\\\"\\n\", \"name\": \"config-writer.service\"}, {\"content\": \"[Unit]\\nDescription=Download the DCOS\\nAfter=network-online.target\\nWants=network-online.target\\nConditionPathExists=!/opt/mesosphere/\\n[Service]\\nType=oneshot\\nExecStartPre=/usr/bin/curl --retry 100 http://s3.amazonaws.com/downloads.mesosphere.io/dcos/EarlyAccess/bootstrap.tar.xz -o /tmp/bootstrap.tar.xz\\nExecStartPre=/usr/bin/mkdir -p /opt/mesosphere\\nExecStart=/usr/bin/tar -xf /tmp/bootstrap.tar.xz -C /opt/mesosphere\\n\", \"name\": \"dcos-download.service\"}, {\"command\": \"start\", \"content\": \"[Unit]\\nDescription=Prep the Pkgpanda working directories for this host.\\nRequires=dcos-download.service\\nAfter=dcos-download.service\\n[Service]\\nType=oneshot\\nEnvironmentFile=/opt/mesosphere/environment\\nExecStart=/opt/mesosphere/bin/pkgpanda setup\\n[Install]\\nWantedBy=multi-user.target\\n\", \"enable\": true, \"name\": \"dcos-setup.service\"}], \"update\": {\"reboot-strategy\": \"off\"}}, \"write_files\": [{\"content\": \"nameserver 168.63.129.16\", \"path\": \"/etc/resolv.conf\"}, {\"content\": \"http://s3.amazonaws.com/downloads.mesosphere.io/dcos/EarlyAccess\", \"owner\": \"root\", \"path\": \"/etc/mesosphere/setup-flags/repository-url\", \"permissions\": 420}, {\"path\": \"/etc/mesosphere/roles/slave\"}, {\"content\": \"{}\", \"path\": \"/etc/mesosphere/setup-packages/dcos-config--setup/pkginfo.json\"}, {\"content\": \"MESOS_MASTER=zk://leader.mesos:2181/mesos\\nMESOS_CONTAINERIZERS=docker,mesos\\nMESOS_LOG_DIR=/var/log/mesos\\nMESOS_EXECUTOR_REGISTRATION_TIMEOUT=5mins\\nMESOS_ISOLATION=cgroups/cpu,cgroups/mem\\nMESOS_WORK_DIR=/var/lib/mesos/slave\\nMESOS_RESOURCES=ports:[1025-2180,2182-3887,3889-5049,5052-8079,8082-65535]\\nMESOS_HOSTNAME=$private_ipv4\\nMESOS_IP=$private_ipv4\\n\", \"path\": \"/etc/mesosphere/setup-packages/dcos-config--setup/etc/mesos-slave\"}, {\"content\": \"MASTER_ELB=', reference('masterNodeNic').ipConfigurations[0].properties.privateIPAddress,'\\nFALLBACK_DNS=168.63.129.16\\n\", \"path\": \"/etc/mesosphere/setup-packages/dcos-config--setup/etc/cloudenv\"}]}'))]",
"linuxConfiguration": {
"disablePasswordAuthentication": "true",
"ssh": {
"publicKeys": [
{
"path": "[variables('sshKeyPath')]",
"keyData": "[parameters('sshKeyData')]"
}
]
}
}
},
"networkProfile": {
"networkInterfaceConfigurations": [
{
"name": "slaveNodeNic",
"properties": {
"primary": "true",
"ipConfigurations": [
{
"name": "nicipconfig",
"properties": {
"subnet": {
"id": "[concat('/subscriptions/', subscription().subscriptionId,'/resourceGroups/', resourceGroup().name, '/providers/Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'), '/subnets/', variables('subnet1Name'))]"
}
}
}
]
}
}
]
}
}
}
},
{
"apiVersion": "[variables('networkApiVersion')]",
"type": "Microsoft.Network/networkInterfaces",
"name": "masterNodeNic",
"location": "[parameters('region')]",
"dependsOn": [
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]",
"[concat('Microsoft.Network/publicIPAddresses/', 'masterPublicIP')]"
],
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIpAddresses', 'masterPublicIP')]"
},
"subnet": {
"id": "[variables('subnet1Ref')]"
}
}
}
]
}
},
{
"apiVersion": "[variables('computeApiVersion')]",
"type": "Microsoft.Compute/virtualMachines",
"name": "mastervm",
"location": "[parameters('region')]",
"dependsOn": [
"Microsoft.Network/networkInterfaces/masterNodeNic",
"[concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]"
],
"properties": {
"hardwareProfile": {
"vmSize": "Standard_A2"
},
"osProfile": {
"computername": "mastervm",
"adminUsername": "[variables('adminUsername')]",
"customData": "[base64(concat('#cloud-config\n\n', '{\"coreos\": {\"units\": [{\"command\": \"start\", \"content\": \"[Unit]\\nDescription=Mount /var/lib\\nBefore=dbus.service\\n[Mount]\\nWhat=/dev/sdb1\\nWhere=/var/lib\\nType=ext4\\n\", \"name\": \"var-lib.mount\"}, {\"command\": \"stop\", \"mask\": true, \"name\": \"systemd-resolved.service\"}, {\"command\": \"stop\", \"mask\": true, \"name\": \"etcd.service\"}, {\"command\": \"start\", \"content\": \"[Unit]\\nDescription=Write out dynamic config values\\n[Service]\\nType=oneshot\\nEnvironmentFile=/etc/environment\\n# Marathon depends on `hostname` resolution working\\nExecStart=/usr/bin/bash -c \\\"echo ${COREOS_PRIVATE_IPV4} $(hostname) ', reference('masterPublicIP').dnsSettings.fqdn,' > /etc/hosts\\\"\\n\", \"name\": \"config-writer.service\"}, {\"content\": \"[Unit]\\nDescription=Download the DCOS\\nAfter=network-online.target\\nWants=network-online.target\\nConditionPathExists=!/opt/mesosphere/\\n[Service]\\nType=oneshot\\nExecStartPre=/usr/bin/curl --retry 100 http://s3.amazonaws.com/downloads.mesosphere.io/dcos/EarlyAccess/bootstrap.tar.xz -o /tmp/bootstrap.tar.xz\\nExecStartPre=/usr/bin/mkdir -p /opt/mesosphere\\nExecStart=/usr/bin/tar -xf /tmp/bootstrap.tar.xz -C /opt/mesosphere\\n\", \"name\": \"dcos-download.service\"}, {\"command\": \"start\", \"content\": \"[Unit]\\nDescription=Prep the Pkgpanda working directories for this host.\\nRequires=dcos-download.service\\nAfter=dcos-download.service\\n[Service]\\nType=oneshot\\nEnvironmentFile=/opt/mesosphere/environment\\nExecStart=/opt/mesosphere/bin/pkgpanda setup\\n[Install]\\nWantedBy=multi-user.target\\n\", \"enable\": true, \"name\": \"dcos-setup.service\"}], \"update\": {\"reboot-strategy\": \"off\"}}, \"write_files\": [{\"content\": \"nameserver 168.63.129.16\", \"path\": \"/etc/resolv.conf\"}, {\"content\": \"http://s3.amazonaws.com/downloads.mesosphere.io/dcos/EarlyAccess\", \"owner\": \"root\", \"path\": \"/etc/mesosphere/setup-flags/repository-url\", \"permissions\": 420}, {\"path\": \"/etc/mesosphere/roles/master\"}, {\"content\": \"{}\", \"path\": \"/etc/mesosphere/setup-packages/dcos-config--setup/pkginfo.json\"}, {\"content\": \"{\\n \\\"zk\\\": \\\"zk://127.0.0.1:2181/mesos\\\",\\n \\\"refreshSeconds\\\": 60,\\n \\\"ttl\\\": 60,\\n \\\"domain\\\": \\\"mesos\\\",\\n \\\"port\\\": 53,\\n \\\"resolvers\\\": [\\\"168.63.129.16\\\"],\\n \\\"timeout\\\": 5,\\n \\\"listener\\\": \\\"0.0.0.0\\\",\\n \\\"email\\\": \\\"root.mesos-dns.mesos\\\"\\n}\\n\", \"path\": \"/etc/mesosphere/setup-packages/dcos-config--setup/etc/mesos-dns.json\"}, {\"content\": \"MESOS_LOG_DIR=/var/log/mesos\\nMESOS_WORK_DIR=/var/lib/mesos/master\\nMESOS_ZK=zk://127.0.0.1:2181/mesos\\nMESOS_QUORUM=', variables('mesosQuorum'),'\\nMESOS_CLUSTER=', variables('uniqueName'),'\\nMESOS_HOSTNAME=', reference('masterPublicIP').dnsSettings.fqdn,'\\nMESOS_IP=$private_ipv4\\n\", \"path\": \"/etc/mesosphere/setup-packages/dcos-config--setup/etc/mesos-master\"}, {\"content\": \"MASTER_ELB=127.0.0.1\\nZOOKEEPER_CLUSTER_SIZE=1\\nFALLBACK_DNS=168.63.129.16\\nMARATHON_HOSTNAME=', reference('masterPublicIP').dnsSettings.fqdn,'\\n\", \"path\": \"/etc/mesosphere/setup-packages/dcos-config--setup/etc/cloudenv\"}, {\"content\": \"AZURE_CONTAINER=apollo-exhibitor\\nAZURE_PREFIX=', variables('uniqueName'),'\\nAZURE_ACCOUNT_NAME=', variables('storageAccountName'),'\\nAZURE_ACCOUNT_KEY=', listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), '2015-05-01-preview').key1,'\\nEXHIBITOR_WEB_UI_PORT=8181\\nEXHIBITOR_HOSTNAME=$private_ipv4\\n\", \"path\": \"/etc/mesosphere/setup-packages/dcos-config--setup/etc/exhibitor\"}]}'))]",
"linuxConfiguration": {
"disablePasswordAuthentication": "true",
"ssh": {
"publicKeys": [
{
"path": "[variables('sshKeyPath')]",
"keyData": "[parameters('sshKeyData')]"
}
]
}
}
},
"storageProfile": {
"imageReference": {
"publisher": "[variables('imagePublisher')]",
"offer": "[variables('imageOffer')]",
"sku": "[variables('imageSku')]",
"version": "latest"
},
"osDisk": {
"name": "mastervm",
"vhd": {
"uri": "[concat('http://',variables('storageAccountName'),'.blob.core.windows.net/',variables('vmStorageAccountContainerName'),'/osdisk.vhd')]"
},
"caching": "ReadWrite",
"createOption": "FromImage"
}
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces','masterNodeNic')]"
}
]
}
}
}
],
"outputs": {
"masterURL0": {
"value": "[reference('masterPublicIP').dnsSettings.fqdn]",
"type": "string"
}
}
}