Skip to content

Instantly share code, notes, and snippets.

@callorico
Created April 13, 2016 20:37
Show Gist options
  • Save callorico/4748d3e56d5c69adaff3ca1b58352e7a to your computer and use it in GitHub Desktop.
Save callorico/4748d3e56d5c69adaff3ca1b58352e7a to your computer and use it in GitHub Desktop.
Simple Azure SLES-HPC cluster
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"adminUsername": {
"type": "string",
"metadata": {
"description": "Username for the Virtual Machine."
}
},
"adminPassword": {
"type": "securestring",
"defaultValue": "",
"metadata": {
"description": "Password for the Virtual Machine."
}
},
"vmSize": {
"type": "string",
"defaultValue": "Standard_A8",
"allowedValues": [
"Standard_A8",
"Standard_A9"
],
"metadata": {
"description": "Size of VM"
}
},
"vmCount": {
"type": "int",
"defaultValue": 2,
"metadata": {
"description": "The number of VMs in the cluster"
}
}
},
"variables": {
"location": "[resourceGroup().location]",
"resourcePrefix": "[uniqueString(resourceGroup().id)]",
"storageAccountName": "[concat(variables('resourcePrefix'), 'storage')]",
"availabilitySetName": "[concat(variables('resourcePrefix'), '-', 'AVSet')]",
"loadBalancerName": "[concat(variables('resourcePrefix'), '-', 'LoadBalancer')]",
"nicName": "[concat(variables('resourcePrefix'), '-', 'VMNic')]",
"addressPrefix": "10.0.0.0/16",
"subnetName": "Subnet",
"subnetPrefix": "10.0.0.0/24",
"networkSecurityGroupName": "[concat(variables('resourcePrefix'), '-', 'SecurityGroup')]",
"publicIPAddressName": "[concat(variables('resourcePrefix'), '-', 'PublicIP')]",
"publicIPAddressType": "Dynamic",
"publicIPAddressID": "[resourceId('Microsoft.Network/publicIPAddresses', variables('publicIPAddressName'))]",
"lbID": "[resourceId('Microsoft.Network/loadBalancers',variables('loadBalancerName'))]",
"frontEndIPConfigID": "[concat(variables('lbID'),'/frontendIPConfigurations/loadBalancerFrontEnd')]",
"vmName": "[concat(variables('resourcePrefix'), '-', 'VM')]",
"virtualNetworkName": "[concat(variables('resourcePrefix'), '-', 'VNET')]",
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks',variables('virtualNetworkName'))]",
"subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]",
"apiVersion": "2015-06-15",
"storageAccountUri": "[concat('https://', variables('storageAccountName'), '.blob.core.windows.net')]"
},
"resources": [
{
"apiVersion": "[variables('apiVersion')]",
"type": "Microsoft.Storage/storageAccounts",
"name": "[variables('storageAccountName')]",
"location": "[variables('location')]",
"properties": {
"accountType": "Standard_LRS"
}
},
{
"apiVersion": "[variables('apiVersion')]",
"type": "Microsoft.Compute/availabilitySets",
"name": "[variables('availabilitySetName')]",
"location": "[variables('location')]",
"properties": {}
},
{
"apiVersion": "[variables('apiVersion')]",
"type": "Microsoft.Network/publicIPAddresses",
"name": "[variables('publicIPAddressName')]",
"location": "[variables('location')]",
"properties": {
"publicIPAllocationMethod": "[variables('publicIPAddressType')]",
"dnsSettings": {
"domainNameLabel": "[concat('dns', variables('resourcePrefix'))]"
}
}
},
{
"apiVersion": "[variables('apiVersion')]",
"type": "Microsoft.Network/virtualNetworks",
"name": "[variables('virtualNetworkName')]",
"location": "[variables('location')]",
"properties": {
"addressSpace": {
"addressPrefixes": [
"[variables('addressPrefix')]"
]
},
"subnets": [
{
"name": "[variables('subnetName')]",
"properties": {
"addressPrefix": "[variables('subnetPrefix')]"
}
}
]
}
},
{
"apiVersion": "[variables('apiVersion')]",
"name": "[variables('loadBalancerName')]",
"type": "Microsoft.Network/loadBalancers",
"location": "[variables('location')]",
"dependsOn": [
"[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]"
],
"properties": {
"frontendIPConfigurations": [
{
"name": "loadBalancerFrontEnd",
"properties": {
"publicIPAddress": {
"id": "[variables('publicIPAddressID')]"
}
}
}
],
"backendAddressPools": [
{
"name": "LoadBalancerBackend"
}
]
}
},
{
"apiVersion": "2015-06-15",
"type": "Microsoft.Network/loadBalancers/inboundNatRules",
"name": "[concat(variables('loadBalancerName'), '/', 'SSH-VM', copyIndex())]",
"location": "[variables('location')]",
"copy": {
"name": "lbNatLoop",
"count": "[parameters('vmCount')]"
},
"dependsOn": [
"[concat('Microsoft.Network/loadBalancers/', variables('loadBalancerName'))]"
],
"properties": {
"frontendIPConfiguration": {
"id": "[variables('frontEndIPConfigID')]"
},
"protocol": "tcp",
"frontendPort": "[copyIndex(22)]",
"backendPort": 22,
"enableFloatingIP": false
}
},
{
"apiVersion": "[variables('apiVersion')]",
"type": "Microsoft.Network/networkInterfaces",
"name": "[concat(variables('nicName'), copyIndex())]",
"copy": {
"name": "nicLoop",
"count": "[parameters('vmCount')]"
},
"location": "[variables('location')]",
"dependsOn": [
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]",
"[concat('Microsoft.Network/loadBalancers/', variables('loadBalancerName'))]",
"[concat('Microsoft.Network/loadBalancers/', variables('loadBalancerName'), '/inboundNatRules/SSH-VM', copyIndex())]"
],
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"subnet": {
"id": "[variables('subnetRef')]"
},
"loadBalancerBackendAddressPools": [
{
"id": "[concat(variables('lbID'), '/backendAddressPools/LoadBalancerBackend')]"
}
],
"loadBalancerInboundNatRules": [
{
"id": "[concat(variables('lbID'),'/inboundNatRules/SSH-VM', copyIndex())]"
}
]
}
}
]
}
},
{
"apiVersion": "[variables('apiVersion')]",
"type": "Microsoft.Compute/virtualMachines",
"name": "[concat(variables('vmName'), copyIndex())]",
"copy": {
"name": "virtualMachineLoop",
"count": "[parameters('vmCount')]"
},
"location": "[variables('location')]",
"dependsOn": [
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'), copyIndex())]"
],
"properties": {
"availabilitySet": {
"id": "[resourceId('Microsoft.Compute/availabilitySets', variables('availabilitySetName'))]"
},
"hardwareProfile": {
"vmSize": "[parameters('vmSize')]"
},
"osProfile": {
"computerName": "[concat('n', copyIndex())]",
"adminUsername": "[parameters('adminUsername')]",
"adminPassword": "[parameters('adminPassword')]"
},
"storageProfile": {
"imageReference": {
"publisher": "SUSE",
"offer": "SLES-HPC",
"sku": "12",
"version": "latest"
},
"osDisk": {
"name": "[concat('osdisk', copyIndex())]",
"vhd": {
"uri": "[concat(variables('storageAccountUri'), '/vhds/', variables('resourcePrefix'), copyIndex(), '.vhd')]"
},
"caching": "ReadWrite",
"createOption": "FromImage"
},
"dataDisks": []
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces', concat(variables('nicName'), copyIndex()))]"
}
]
}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment