Skip to content

Instantly share code, notes, and snippets.

@johann8384
Last active November 10, 2017 22:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johann8384/8acb6184e01a9257414dd5fb6b8c9954 to your computer and use it in GitHub Desktop.
Save johann8384/8acb6184e01a9257414dd5fb6b8c9954 to your computer and use it in GitHub Desktop.
Cloudbreak Datalake Template
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"securityGroupName": {
"type": "string",
"metadata": {
"description": "Security Group"
}
},
"prefix": {
"type": "string",
"defaultValue": "dl",
"metadata": {
"description": "Prefix for Resource Names"
}
},
"vmSize": {
"type": "string",
"defaultValue": "Standard_DS2",
"allowedValues": [
"Standard_DS2",
"Standard_DS3",
"Standard_DS4",
"Standard_DS11",
"Standard_DS12",
"Standard_DS13",
"Standard_DS14",
"Standard_DS2_v2",
"Standard_DS3_v2",
"Standard_DS4_v2",
"Standard_DS11_v2",
"Standard_DS12_v2",
"Standard_DS13_v2",
"Standard_DS14_v2"
],
"metadata": {
"description": "Size of vm"
}
},
"adminUsername": {
"type": "string",
"defaultValue": "admin@example.com",
"minLength": 6,
"metadata": {
"description": "Username for the Admin account. Must be a valid email address."
}
},
"adminUserPassword": {
"type": "securestring",
"minLength": 6,
"metadata": {
"description": "Password for Admin account. Must be at least 8 characters containing letters, numbers and symbols."
}
},
"username": {
"type": "string",
"defaultValue": "cloudbreak",
"metadata": {
"description": "Username for the Virtual Machine."
}
},
"smartsense": {
"type": "string",
"defaultValue": "false",
"allowedValues": [
"true",
"false"
],
"metadata": {
"description": "By Opting-In, you read and agree to the SmartSense terms."
}
},
"remoteLocation": {
"type": "string",
"defaultValue": "INTERNET",
"metadata": {
"description": "Allow connections from this address range. Must be a valid CIDR IP."
}
},
"sshKey": {
"type": "string",
"defaultValue": "",
"metadata": {
"description": "SSH key for cloudbreak"
}
}
},
"variables": {
"newStorageAccountName": "[concat(parameters('prefix'),'storage', uniqueString(resourceGroup().id))]",
"fileUris": "https://raw.githubusercontent.com/sequenceiq/azure-cbd-quickstart/1.16.1/install-cbd.sh",
"commandToExecute": "./install-cbd.sh",
"extensionName": "CustomScript",
"scenarioPrefix": "parameters('prefix')",
"apiVersion": "2016-06-01",
"imagePublisher": "hortonworks",
"imageOffer": "cloudbreak-for-hortonworks-data-platform-preview",
"imageSku": "cloudbreak-for-hortonworks-data-platform",
"osDiskName": "[concat(variables('scenarioPrefix'),'OSDisk')]",
"osDiskUri": "[concat('http://',variables('newStorageAccountName'),'.blob.core.windows.net/',variables('vmStorageAccountContainerName'),'/',variables('OSDiskName'),'.vhd')]",
"osDiskCreateOption": "FromImage",
"nicName": "[concat(variables('scenarioPrefix'),'Nic')]",
"sshKeyPath": "[concat('/home/',parameters('username'),'/.ssh/authorized_keys')]",
"vnetAddressPrefix": "10.0.0.0/16",
"subnetName": "[concat(variables('scenarioPrefix'),'Subnet')]",
"subnetPrefix": "10.0.0.0/24",
"storageAccountType": "Standard_LRS",
"publicIPAddressName": "[concat(variables('scenarioPrefix'),'PublicIp')]",
"publicIPAddressType": "Static",
"vmStorageAccountContainerName": "vhds",
"vmName": "[concat(variables('scenarioPrefix'),'VM')]",
"virtualNetworkName": "[concat(variables('scenarioPrefix'),'Vnet')]",
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks',variables('virtualNetworkName'))]",
"subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]",
"singleQuote": "'",
"defaultBlueprints": "Data Science: Apache Spark 1.6, Apache Zeppelin 0.6.0=hdp25-data-science;EDW-ETL: Apache Hive 1.2.1, Apache Spark 1.6=hdp25-etl-edw;EDW-ETL: Apache Hive 1.2.1, Apache Spark 2.0=hdp25-etl-edw-spark2;EDW-Analytics: Apache Hive 2 LLAP, Apache Zeppelin 0.6.0=hdp25-edw-analytics;Data Science: Apache Spark 1.6, Apache Zeppelin 0.7.0=hdp26-data-science;26EDW-ETL: Apache Hive 1.2.1, Apache Spark 1.6=hdp26-etl-edw;EDW-ETL: Apache Hive 1.2.1, Apache Spark 2.1=hdp26-etl-edw-spark2;EDW-Analytics: Apache Hive 2 LLAP, Apache Zeppelin 0.7.0=hdp26-edw-analytics;BI: Druid 0.9.2 (Technical Preview)=hdp26-druid-bi;Data Science: Apache Spark 2.1, Apache Zeppelin 0.7.0=hdp26-data-science-spark2"
},
"resources": [
{
"type": "Microsoft.Storage/storageAccounts",
"name": "[variables('newStorageAccountName')]",
"apiVersion": "2015-06-15",
"location": "[resourceGroup().location]",
"properties": {
"accountType": "[variables('storageAccountType')]"
}
},
{
"apiVersion": "[variables('apiVersion')]",
"type": "Microsoft.Network/publicIPAddresses",
"name": "[variables('publicIPAddressName')]",
"location": "[resourceGroup().location]",
"properties": {
"publicIPAllocationMethod": "[variables('publicIPAddressType')]",
"dnsSettings": {
"domainNameLabel": "[concat('cloudbreak-controller-', uniqueString(resourceGroup().id))]"
}
}
},
{
"apiVersion": "[variables('apiVersion')]",
"type": "Microsoft.Network/virtualNetworks",
"name": "[variables('virtualNetworkName')]",
"location": "[resourceGroup().location]",
"properties": {
"addressSpace": {
"addressPrefixes": [
"[variables('vnetAddressPrefix')]"
]
},
"subnets": [
{
"name": "[variables('subnetName')]",
"properties": {
"addressPrefix": "[variables('subnetPrefix')]"
}
}
]
}
},
{
"apiVersion": "[variables('apiVersion')]",
"type": "Microsoft.Network/networkSecurityGroups",
"name": "[parameters('securityGroupName')]",
"location": "[resourceGroup().location]",
"properties": {
"securityRules": [
{
"name": "ssh_rule",
"properties": {
"description": "Allow SSH",
"protocol": "Tcp",
"sourcePortRange": "*",
"destinationPortRange": "22",
"sourceAddressPrefix": "[parameters('remoteLocation')]",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 100,
"direction": "Inbound"
}
},
{
"name": "http_rule",
"properties": {
"description": "Allow HTTP",
"protocol": "Tcp",
"sourcePortRange": "*",
"destinationPortRange": "80",
"sourceAddressPrefix": "[parameters('remoteLocation')]",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 101,
"direction": "Inbound"
}
},
{
"name": "https_rule",
"properties": {
"description": "Allow HTTPS",
"protocol": "Tcp",
"sourcePortRange": "*",
"destinationPortRange": "443",
"sourceAddressPrefix": "[parameters('remoteLocation')]",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 102,
"direction": "Inbound"
}
}
]
}
},
{
"apiVersion": "[variables('apiVersion')]",
"type": "Microsoft.Network/networkInterfaces",
"name": "[variables('nicName')]",
"location": "[resourceGroup().location]",
"dependsOn": [
"[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]",
"[concat('Microsoft.Network/networkSecurityGroups/', parameters('securityGroupName'))]",
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]"
],
"properties": {
"networkSecurityGroup": {
"id": "[concat(resourceId('Microsoft.Network/networkSecurityGroups', parameters('securityGroupName')))]"
},
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]"
},
"subnet": {
"id": "[variables('subnetRef')]"
}
}
}
]
}
},
{
"apiVersion": "2016-04-30-preview",
"type": "Microsoft.Compute/virtualMachines",
"name": "[variables('vmName')]",
"location": "[resourceGroup().location]",
"dependsOn": [
"[concat('Microsoft.Storage/storageAccounts/', variables('newStorageAccountName'))]",
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]"
],
"plan": {
"name": "[variables('imageSku')]",
"product": "[variables('imageOffer')]",
"publisher": "[variables('imagePublisher')]"
},
"properties": {
"hardwareProfile": {
"vmSize": "[parameters('vmSize')]"
},
"osProfile": {
"computerName": "[variables('vmName')]",
"adminUsername": "[parameters('username')]",
"linuxConfiguration": {
"disablePasswordAuthentication": true,
"ssh": {
"publicKeys": [
{
"path": "[variables('sshKeyPath')]",
"keyData": "[parameters('sshKey')]"
}
]
}
},
"customData": "[base64(concat('#!/bin/bash\n','\necho \"export PUBLIC_IP=',reference(variables('publicIPAddressName')).dnsSettings.fqdn,'\" >> /tmp/.cbdprofile','\necho \"export CB_TRAEFIK_HOST_ADDRESS=',reference(variables('publicIPAddressName')).ipAddress,'\" >> /tmp/.cbdprofile','\necho \"export CBD_VERSION=1.16.1\" >> /tmp/.cbdprofile','\necho \"export AZURE_SUBSCRIPTION_ID=',subscription().subscriptionId,'\" >> /tmp/.cbdprofile','\necho \"export AZURE_TENANT_ID=',subscription().tenantId,'\" >> /tmp/.cbdprofile','\necho \"export UAA_DEFAULT_USER_EMAIL=',parameters('adminUsername'),'\" >> /tmp/.cbdprofile','\necho \"export UAA_DEFAULT_USER_PW=',parameters('adminUserPassword'),'\" >> /tmp/.cbdprofile','\necho \"export CB_SMARTSENSE_CONFIGURE=',parameters('smartsense'),'\" >> /tmp/.cbdprofile','\necho \"export OS_USER=',parameters('username'),'\" >> /tmp/.cbdprofile', '\necho \"export ULU_DEFAULT_SSH_KEY=',variables('singleQuote'),parameters('sshKey'),variables('singleQuote'),'\" >> /tmp/.cbdprofile', '\necho \"export CB_BLUEPRINT_DEFAULTS=',variables('singleQuote'),variables('defaultBlueprints'),variables('singleQuote'),'\" >> /tmp/.cbdprofile', '\necho \"export UAA_DEFAULT_SECRET=',base64(resourceGroup().id),'\" >> /tmp/.cbdprofile'))]"
},
"storageProfile": {
"imageReference": {
"publisher": "[variables('imagePublisher')]",
"offer": "[variables('imageOffer')]",
"sku": "[variables('imageSku')]",
"version": "latest"
},
"osDisk": {
"name": "osdisk1",
"vhd": {
"uri": "[variables('osDiskUri')]"
},
"caching": "ReadWrite",
"createOption": "[variables('osDiskCreateOption')]"
}
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces',variables('nicName'))]"
}
]
}
}
},
{
"type": "Microsoft.Compute/virtualMachines/extensions",
"name": "[concat(variables('vmName'),'/installcustomscript')]",
"apiVersion": "2015-06-15",
"location": "[resourceGroup().location]",
"dependsOn": [
"[concat('Microsoft.Compute/virtualMachines/', variables('vmName'))]"
],
"properties": {
"publisher": "Microsoft.Azure.Extensions",
"type": "CustomScript",
"typeHandlerVersion": "2.0",
"settings": {
"fileUris": "[split(variables('fileUris'), ' ')]",
"commandToExecute": "[variables('commandToExecute')]"
}
}
}
],
"outputs": {
"loginUrl": {
"type": "string",
"value": "[reference(variables('publicIPAddressName')).dnsSettings.fqdn]"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment