Skip to content

Instantly share code, notes, and snippets.

@hausdorff
Last active August 29, 2015 14:19
Show Gist options
  • Select an option

  • Save hausdorff/f0e524bc800cf641a3db to your computer and use it in GitHub Desktop.

Select an option

Save hausdorff/f0e524bc800cf641a3db to your computer and use it in GitHub Desktop.
{
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"adminUsername": {
"type": "string",
"metadata": {
"Description": "Admin username used when provisioning virtual machines"
}
},
"storageAccountName": {
"type": "string",
"defaultValue": "uniqueStorageAccountName",
"metadata": {
"Description": "Unique namespace for the Storage Account where the Virtual Machine's disks will be placed"
}
},
"region": {
"type": "string",
"defaultValue": "West US",
"metadata": {
"Description": "Location where resources will be provisioned"
}
},
"virtualNetworkName": {
"type": "string",
"defaultValue": "vnet",
"metadata": {
"Description": "Virtual Network"
}
},
"vmSizeMasterNodes": {
"type": "string",
"defaultValue": "Standard_A3",
"metadata": {
"Description": "Size of the Master nodes"
}
},
"vmSizeSlaveNodes": {
"type": "string",
"defaultValue": "Standard_A3",
"metadata": {
"Description": "Size of the Slave nodes"
}
},
"numberOfMasters": {
"type": "int",
"defaultValue": 1,
"metadata": {
"Description": "Number of Master nodes (1, 3, or 5)"
}
},
"numberOfSlaves": {
"type": "int",
"defaultValue": 1,
"metadata": {
"Description": "Number of Slave nodes"
}
},
"addressPrefix": {
"type": "string",
"defaultValue": "10.0.0.0/16",
"metadata": {
"Description": "Address space for the VNET"
}
},
"subnet1Name": {
"type": "string",
"defaultValue": "Data",
"metadata": {
"Description": "Subnet name for the VNET that resources will be provisionined in to"
}
},
"subnet1Prefix": {
"type": "string",
"defaultValue": "10.0.0.0/24",
"metadata": {
"Description": "Address space for the subnet"
}
},
"sshKeyData": {
"type": "string",
"metadata": {
"Description": "Public key for SSH authentication"
}
},
"uuid": {
"type": "string",
"metadata": {
"Description": "Globally unique cluster identifier in Azure namespace"
}
},
"azureAccountName": {
"type": "string",
"metadata": {
"Description": "Azure account name used by Exhibitor to persist Zookeeper state"
}
},
"azureAccountKey": {
"type": "string",
"metadata": {
"Description": "Azure account key used by Exhibitor to persist Zookeeper state"
}
}
},
"variables": {
"vmStorageAccountContainerName": "vhd",
"vmSourceImageName": "2b171e93f07c4903bcad35bda10acf22__CoreOS-Beta-633.1.0",
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks',parameters('virtualNetworkName'))]",
"subnet1Ref": "[concat(variables('vnetID'),'/subnets/',parameters('subnet1Name'))]",
"sourceImageName": "[concat('/', subscription().subscriptionId,'/services/images/',variables('vmSourceImageName'))]",
"sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]",
"masterCustomData": "[concat('#cloud-config\n\n', '{\"write_files\": [{\"path\": \"/etc/resolv.conf\", \"content\": \"nameserver 168.63.129.16\"}, {\"owner\": \"root\", \"path\": \"/etc/mesosphere/setup-flags/repository-url\", \"permissions\": 420, \"content\": \"http://s3.amazonaws.com/downloads.mesosphere.io/dcos/testing/eap2-rc5\"}, {\"path\": \"/etc/mesosphere/roles/master\"}, {\"path\": \"/etc/mesosphere/setup-packages/dcos-config--setup/pkginfo.json\", \"content\": \"{}\"}, {\"path\": \"/etc/mesosphere/setup-packages/dcos-config--setup/etc/mesos-dns.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-master\", \"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=', parameters('numberOfMasters'),'\\nMESOS_CLUSTER=', parameters('uuid'),'\\nMESOS_HOSTNAME=$private_ipv4\\nMESOS_IP=$private_ipv4\\n\"}, {\"path\": \"/etc/mesosphere/setup-packages/dcos-config--setup/etc/cloudenv\", \"content\": \"MASTER_ELB=127.0.0.1\\nZOOKEEPER_CLUSTER_SIZE=', parameters('numberOfMasters'),'\\nFALLBACK_DNS=168.63.129.16\\nMARATHON_HOSTNAME=$private_ipv4\\n\"}, {\"path\": \"/etc/mesosphere/setup-packages/dcos-config--setup/etc/exhibitor\", \"content\": \"AZURE_CONTAINER=apollo-exhibitor\\nAZURE_PREFIX=', parameters('uuid'),'\\nAZURE_ACCOUNT_NAME=', parameters('azureAccountName'),'\\nAZURE_ACCOUNT_KEY=', parameters('azureAccountKey'),'\\nEXHIBITOR_WEB_UI_PORT=8181\\nEXHIBITOR_HOSTNAME=$private_ipv4\\n\"}], \"coreos\": {\"update\": {\"reboot-strategy\": \"off\"}, \"units\": [{\"name\": \"var-lib.mount\", \"command\": \"start\", \"content\": \"[Unit]\\nDescription=Mount /var/lib\\nBefore=dbus.service\\n[Mount]\\nWhat=/dev/sdb1\\nWhere=/var/lib\\nType=ext4\\n\"}, {\"name\": \"systemd-resolved.service\", \"command\": \"stop\", \"mask\": true}, {\"name\": \"etcd.service\", \"command\": \"stop\", \"mask\": true}, {\"name\": \"config-writer.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\": \"dcos-download.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 http://s3.amazonaws.com/downloads.mesosphere.io/dcos/testing/eap2-rc5/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-setup.service\", \"command\": \"start\", \"enable\": true, \"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\"}]}}')]",
"slaveCustomData": "[concat('#cloud-config\n\n', '{\"coreos\": {\"units\": [{\"name\": \"var-lib.mount\", \"content\": \"[Unit]\\nDescription=Mount /var/lib\\nBefore=dbus.service\\n[Mount]\\nWhat=/dev/sdb1\\nWhere=/var/lib\\nType=ext4\\n\", \"command\": \"start\"}, {\"name\": \"systemd-resolved.service\", \"mask\": true, \"command\": \"stop\"}, {\"name\": \"etcd.service\", \"mask\": true, \"command\": \"stop\"}, {\"name\": \"config-writer.service\", \"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\", \"command\": \"start\"}, {\"name\": \"dcos-download.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 http://s3.amazonaws.com/downloads.mesosphere.io/dcos/testing/eap2-rc5/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-setup.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}], \"update\": {\"reboot-strategy\": \"off\"}}, \"write_files\": [{\"path\": \"/etc/resolv.conf\", \"content\": \"nameserver 168.63.129.16\"}, {\"owner\": \"root\", \"path\": \"/etc/mesosphere/setup-flags/repository-url\", \"content\": \"http://s3.amazonaws.com/downloads.mesosphere.io/dcos/testing/eap2-rc5\", \"permissions\": 420}, {\"path\": \"/etc/mesosphere/roles/slave\"}, {\"path\": \"/etc/mesosphere/setup-packages/dcos-config--setup/pkginfo.json\", \"content\": \"{}\"}, {\"path\": \"/etc/mesosphere/setup-packages/dcos-config--setup/etc/mesos-slave\", \"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/cloudenv\", \"content\": \"MASTER_ELB=master0-', parameters('uuid'),'.westus.cloudapp.azure.com\\nFALLBACK_DNS=168.63.129.16\\n\"}]}')]"
},
"resources": [
{
"type": "Microsoft.Storage/storageAccounts",
"name": "[parameters('storageAccountName')]",
"apiVersion": "2014-12-01-preview",
"location": "[parameters('region')]",
"properties": {
"accountType": "Standard_LRS"
}
},
{
"apiVersion": "2014-12-01-preview",
"type": "Microsoft.Compute/availabilitySets",
"name": "slaves",
"location": "[parameters('region')]",
"properties": {}
},
{
"apiVersion": "2014-12-01-preview",
"type": "Microsoft.Compute/availabilitySets",
"name": "masters",
"location": "[parameters('region')]",
"properties": {}
},
{
"apiVersion": "2014-12-01-preview",
"type": "Microsoft.Network/virtualNetworks",
"name": "[parameters('virtualNetworkName')]",
"location": "[parameters('region')]",
"properties": {
"addressSpace": {
"addressPrefixes": [
"[parameters('addressPrefix')]"
]
},
"subnets": [
{
"name": "[parameters('subnet1Name')]",
"properties": {
"addressPrefix": "[parameters('subnet1Prefix')]"
}
}
]
}
},
{
"type": "Microsoft.Network/publicIPAddresses",
"name": "[concat('masterPublicIP', copyindex())]",
"copy": {
"name": "ipLoop",
"count": "[parameters('numberOfMasters')]"
},
"location": "[parameters('region')]",
"apiVersion": "2014-12-01-preview",
"properties": {
"publicIPAllocationMethod": "Dynamic",
"dnsSettings": {
"domainNameLabel": "[concat('master', copyindex(), '-', parameters('uuid'))]"
}
}
},
{
"type": "Microsoft.Network/publicIPAddresses",
"name": "slavePublicIP0",
"location": "[parameters('region')]",
"apiVersion": "2014-12-01-preview",
"properties": {
"publicIPAllocationMethod": "Dynamic",
"dnsSettings": {
"domainNameLabel": "[concat('slave0', '-', parameters('uuid'))]"
}
}
},
{
"type": "Microsoft.Network/publicIPAddresses",
"name": "[concat('slavePublicIP', copyindex(1))]",
"copy": {
"name": "ipLoop",
"count": "[parameters('numberOfSlaves')]"
},
"location": "[parameters('region')]",
"apiVersion": "2014-12-01-preview",
"properties": {
"publicIPAllocationMethod": "Dynamic",
"dnsSettings": {
"domainNameLabel": "[concat('slave', copyindex(1), '-', parameters('uuid'))]"
}
}
},
{
"apiVersion": "2014-12-01-preview",
"type": "Microsoft.Network/networkInterfaces",
"name": "slaveNodeNic0",
"location": "[parameters('region')]",
"dependsOn": [
"[concat('Microsoft.Network/virtualNetworks/', parameters('virtualNetworkName'))]",
"[concat('Microsoft.Network/publicIPAddresses/', 'slavePublicIP0')]"
],
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIpAddresses', concat('slavePublicIP0'))]"
},
"subnet": {
"id": "[variables('subnet1Ref')]"
}
}
}
]
}
},
{
"apiVersion": "2014-12-01-preview",
"type": "Microsoft.Network/networkInterfaces",
"name": "[concat('slaveNodeNic', copyindex(1))]",
"location": "[parameters('region')]",
"copy": {
"name": "slaveNodesNicLoop",
"count": "[parameters('numberOfSlaves')]"
},
"dependsOn": [
"[concat('Microsoft.Network/virtualNetworks/', parameters('virtualNetworkName'))]",
"[concat('Microsoft.Network/publicIPAddresses/', 'slavePublicIP', copyindex(1))]"
],
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIpAddresses', concat('slavePublicIP', copyindex(1)))]"
},
"subnet": {
"id": "[variables('subnet1Ref')]"
}
}
}
]
}
},
{
"apiVersion": "2014-12-01-preview",
"type": "Microsoft.Compute/virtualMachines",
"name": "slave0",
"location": "[parameters('region')]",
"dependsOn": [
"[concat('Microsoft.Network/networkInterfaces/', 'slaveNodeNic0')]",
"[concat('Microsoft.Storage/storageAccounts/', parameters('storageAccountName'))]",
"[concat('Microsoft.Compute/availabilitySets/', 'slaves')]"
],
"properties": {
"availabilitySet": {
"id": "[resourceId('Microsoft.Compute/availabilitySets', 'slaves')]"
},
"hardwareProfile": {
"vmSize": "[parameters('vmSizeSlaveNodes')]"
},
"osProfile": {
"computername": "slave0",
"adminUsername": "[parameters('adminUsername')]",
"customData": "[base64(variables('slaveCustomData'))]",
"linuxConfiguration": {
"disablePasswordAuthentication": "true",
"ssh": {
"publicKeys": [
{
"path": "[variables('sshKeyPath')]",
"keyData": "[parameters('sshKeyData')]"
}
]
}
}
},
"storageProfile": {
"sourceImage": {
"id": "[variables('sourceImageName')]"
},
"destinationVhdsContainer": "[concat('http://',parameters('storageAccountName'),'.blob.core.windows.net/',variables('vmStorageAccountContainerName'),'/')]"
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces', 'slaveNodeNic0')]"
}
]
}
}
},
{
"apiVersion": "2014-12-01-preview",
"type": "Microsoft.Compute/virtualMachines",
"name": "[concat('slave', copyindex(1))]",
"location": "[parameters('region')]",
"copy": {
"name": "slaveVmLoop",
"count": "[parameters('numberOfSlaves')]"
},
"dependsOn": [
"[concat('Microsoft.Network/networkInterfaces/', 'slaveNodeNic', copyindex(1))]",
"[concat('Microsoft.Storage/storageAccounts/', parameters('storageAccountName'))]",
"[concat('Microsoft.Compute/availabilitySets/', 'slaves')]",
"[concat('Microsoft.Compute/virtualMachines/', 'slave0')]"
],
"properties": {
"availabilitySet": {
"id": "[resourceId('Microsoft.Compute/availabilitySets', 'slaves')]"
},
"hardwareProfile": {
"vmSize": "[parameters('vmSizeSlaveNodes')]"
},
"osProfile": {
"computername": "[concat('slave', copyIndex(1))]",
"adminUsername": "[parameters('adminUsername')]",
"customData": "[base64(variables('slaveCustomData'))]",
"linuxConfiguration": {
"disablePasswordAuthentication": "true",
"ssh": {
"publicKeys": [
{
"path": "[variables('sshKeyPath')]",
"keyData": "[parameters('sshKeyData')]"
}
]
}
}
},
"storageProfile": {
"sourceImage": {
"id": "[variables('sourceImageName')]"
},
"destinationVhdsContainer": "[concat('http://',parameters('storageAccountName'),'.blob.core.windows.net/',variables('vmStorageAccountContainerName'),'/')]"
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces',concat('slaveNodeNic', copyindex(1)))]"
}
]
}
}
},
{
"apiVersion": "2014-12-01-preview",
"type": "Microsoft.Network/networkInterfaces",
"name": "[concat('masterNodeNic', copyindex())]",
"location": "[parameters('region')]",
"copy": {
"name": "masterNicLoop",
"count": "[parameters('numberOfMasters')]"
},
"dependsOn": [
"[concat('Microsoft.Network/virtualNetworks/', parameters('virtualNetworkName'))]",
"[concat('Microsoft.Network/publicIPAddresses/', 'masterPublicIP', copyindex())]"
],
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIpAddresses', concat('masterPublicIP', copyindex()))]"
},
"subnet": {
"id": "[variables('subnet1Ref')]"
}
}
}
]
}
},
{
"apiVersion": "2014-12-01-preview",
"type": "Microsoft.Compute/virtualMachines",
"name": "[concat('master', copyindex())]",
"location": "[parameters('region')]",
"copy": {
"name": "masterVmLoop",
"count": "[parameters('numberOfMasters')]"
},
"dependsOn": [
"[concat('Microsoft.Network/networkInterfaces/', 'masterNodeNic', copyindex())]",
"[concat('Microsoft.Compute/availabilitySets/', 'masters')]",
"[concat('Microsoft.Storage/storageAccounts/', parameters('storageAccountName'))]"
],
"properties": {
"availabilitySet": {
"id": "[resourceId('Microsoft.Compute/availabilitySets', 'masters')]"
},
"hardwareProfile": {
"vmSize": "[parameters('vmSizeMasterNodes')]"
},
"osProfile": {
"computername": "[concat('master', copyIndex())]",
"adminUsername": "[parameters('adminUsername')]",
"customData": "[base64(variables('masterCustomData'))]",
"linuxConfiguration": {
"disablePasswordAuthentication": "true",
"ssh": {
"publicKeys": [
{
"path": "[variables('sshKeyPath')]",
"keyData": "[parameters('sshKeyData')]"
}
]
}
}
},
"storageProfile": {
"sourceImage": {
"id": "[variables('sourceImageName')]"
},
"destinationVhdsContainer": "[concat('http://',parameters('storageAccountName'),'.blob.core.windows.net/',variables('vmStorageAccountContainerName'),'/')]"
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces',concat('masterNodeNic', copyindex()))]"
}
]
}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment