Skip to content

Instantly share code, notes, and snippets.

@siddheshwar-more
Last active September 22, 2015 16:08
Show Gist options
  • Save siddheshwar-more/524018096b8963769563 to your computer and use it in GitHub Desktop.
Save siddheshwar-more/524018096b8963769563 to your computer and use it in GitHub Desktop.
Azure ARM template for Linux chef extension
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters" : {
"newStorageAccountName": {
"type": "string",
"metadata" : {
"description": "Unique Name for the Storage Account where the Virtual Machine's disks will be placed"
}
},
"vmDnsName": {
"type": "string",
"metadata" : {
"description": "DNS name for the VM"
}
},
"adminUserName": {
"type": "string",
"metadata" : {
"description": "Admin user name for the Virtual Machines"
}
},
"adminPassword": {
"type": "securestring",
"metadata" : {
"description": "Admin password for the Virtual Machine"
}
},
"imagePublisher": {
"type": "string",
"defaultValue": "Canonical",
"metadata": {
"description": "Publisher for the OS image, the default is Canonical"
}
},
"imageOffer": {
"type": "string",
"defaultValue": "UbuntuServer",
"metadata": {
"description": "The name of the image offer. The default is Ubuntu"
}
},
"imageSKU": {
"type": "string",
"defaultValue": "14.04.2-LTS",
"metadata": {
"description": "Version of the image. The default is 14.04.2-LTS"
}
},
"location": {
"type": "string",
"defaultValue" : "West US",
"metadata": {
"description": "Location name where the corresponding Azure artifacts will be created"
}
},
"vmSize": {
"type": "string",
"defaultValue": "Standard_A0",
"metadata": {
"description": "VM Size"
}
},
"chef_node_name": {
"type": "string",
"metadata" : {
"description": "The name for the node (VM) in the Chef Organization"
}
},
"chef_server_url": {
"type": "string",
"metadata" : {
"description": "Organization URL for the Chef Server. Example https://ChefServerDnsName.cloudapp.net/organizations/Orgname"
}
},
"validation_client_name": {
"type": "string",
"metadata" : {
"description": "Validator key name for the organization. Example : MyOrg-validator"
}
},
"runlist": {
"type": "string",
"defaultValue": "recipe[getting-started]",
"metadata" : {
"description": "Optional Run List to Execute"
}
},
"autoUpdateClient": {
"type": "string",
"defaultValue": "false",
"metadata" : {
"description": "Optional Flag for auto update"
}
},
"validation_key": {
"type": "string",
"metadata" : {
"description": "JSON Escaped Validation Key"
}
}
},
"variables": {
"vnetID":"[resourceId('Microsoft.Network/virtualNetworks',variables('virtualNetworkName'))]",
"subnet1Ref" : "[concat(variables('vnetID'),'/subnets/',variables('subnet1Name'))]",
"vmExtensionName" : "LinuxChefExtension",
"vmName": "[parameters('vmDnsName')]",
"storageAccountType" : "Standard_LRS",
"publicIPAddressName" : "myPublicIP",
"publicIPAddressType" : "Dynamic",
"vmStorageAccountContainerName" : "vhds",
"virtualNetworkName" : "MyVNET",
"addressPrefix" : "10.0.0.0/16",
"subnet1Name": "subnet-1",
"subnet2Name": "subnet-2",
"subnet1Prefix" : "10.0.0.0/24",
"subnet2Prefix" : "10.0.1.0/24",
"nicName" : "myVMNic",
"dnsName" : "[variables('subnet1Name')]"
},
"resources": [
{
"type": "Microsoft.Storage/storageAccounts",
"name": "[parameters('newStorageAccountName')]",
"apiVersion": "2015-05-01-preview",
"location": "[parameters('location')]",
"properties": {
"accountType": "[variables('storageAccountType')]"
}
},
{
"apiVersion": "2015-05-01-preview",
"type": "Microsoft.Network/publicIPAddresses",
"name": "[variables('publicIPAddressName')]",
"location": "[parameters('location')]",
"properties": {
"publicIPAllocationMethod": "[variables('publicIPAddressType')]",
"dnsSettings": {
"domainNameLabel": "[parameters('vmDnsName')]"
}
}
},
{
"apiVersion": "2015-05-01-preview",
"type": "Microsoft.Network/virtualNetworks",
"name": "[variables('virtualNetworkName')]",
"location": "[parameters('location')]",
"properties": {
"addressSpace": {
"addressPrefixes": [
"[variables('addressPrefix')]"
]
},
"subnets": [
{
"name": "[variables('subnet1Name')]",
"properties" : {
"addressPrefix": "[variables('subnet1Prefix')]"
}
},
{
"name": "[variables('subnet2Name')]",
"properties" : {
"addressPrefix": "[variables('subnet2Prefix')]"
}
}
]
}
},
{
"apiVersion": "2015-05-01-preview",
"type": "Microsoft.Network/networkInterfaces",
"name": "[variables('nicName')]",
"location": "[parameters('location')]",
"dependsOn": [
"[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]",
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]"
],
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]"
},
"subnet": {
"id": "[variables('subnet1Ref')]"
}
}
}
]
}
},
{
"apiVersion": "2015-05-01-preview",
"type": "Microsoft.Compute/virtualMachines",
"name": "[variables('vmName')]",
"location": "[parameters('location')]",
"dependsOn": [
"[concat('Microsoft.Storage/storageAccounts/', parameters('newStorageAccountName'))]",
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]"
],
"properties": {
"hardwareProfile": {
"vmSize": "[parameters('vmSize')]"
},
"osProfile": {
"computername": "[variables('vmName')]",
"adminUsername": "[parameters('adminUsername')]",
"adminPassword": "[parameters('adminPassword')]"
},
"storageProfile": {
"imageReference": {
"publisher": "[parameters('imagePublisher')]",
"offer": "[parameters('imageOffer')]",
"sku" : "[parameters('imageSKU')]",
"version":"latest"
},
"osDisk" : {
"name": "osdisk",
"vhd": {
"uri": "[concat('http://',parameters('newStorageAccountName'),'.blob.core.windows.net/vhds/','osdisk.vhd')]"
},
"caching": "ReadWrite",
"createOption": "FromImage"
}
},
"networkProfile": {
"networkInterfaces" : [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces',variables('nicName'))]"
}
]
}
}
},
{
"type": "Microsoft.Compute/virtualMachines/extensions",
"name": "[concat(variables('vmName'),'/', variables('vmExtensionName'))]",
"apiVersion": "2015-05-01-preview",
"location": "[parameters('location')]",
"dependsOn": [
"[concat('Microsoft.Compute/virtualMachines/', variables('vmName'))]"
],
"properties": {
"publisher": "Chef.Bootstrap.WindowsAzure",
"type": "LinuxChefClient",
"typeHandlerVersion": "1210.12",
"settings": {
"bootstrap_options":
{
"chef_node_name" : "[parameters('chef_node_name')]",
"chef_server_url" : "[parameters('chef_server_url')]",
"validation_client_name" : "[parameters('validation_client_name')]"
},
"runlist": "[parameters('runlist')]"
},
"protectedSettings": {
"validation_key": "[parameters('validation_key')]"
}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment