Skip to content

Instantly share code, notes, and snippets.

@Nosmadas
Last active August 8, 2016 12:36
Show Gist options
  • Save Nosmadas/3002e6388a70f7cbb614f34e82362e82 to your computer and use it in GitHub Desktop.
Save Nosmadas/3002e6388a70f7cbb614f34e82362e82 to your computer and use it in GitHub Desktop.
Logstash(2.3.4) Ubuntu(14.04) VM
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"encodedConfigString": {
"type": "string",
"metadata": {
"description": "Base64 encoded Logstash configuration string."
}
},
"newStorageAccountName": {
"type": "string",
"metadata": {
"description": "Unique DNS Name for the Storage Account where the Virtual Machine's disks will be placed."
}
},
"adminUsername": {
"type": "string",
"metadata": {
"description": "User name for the Virtual Machine."
}
},
"adminPassword": {
"type": "securestring",
"metadata": {
"description": "Password for the Virtual Machine."
}
},
"dnsNameForPublicIP": {
"type": "string",
"metadata": {
"description": "Unique DNS Name for the Public IP used to access the Virtual Machine."
}
},
"ubuntuOSVersion": {
"type": "string",
"defaultValue": "14.04.2-LTS",
"allowedValues": [
"12.04.2-LTS",
"12.04.3-LTS",
"12.04.4-LTS",
"12.04.5-LTS",
"12.10",
"14.04.2-LTS",
"14.10",
"15.04"
],
"metadata": {
"description": "The Ubuntu version for the VM. This will pick a fully patched image of this given Ubuntu version. Allowed values: 12.04.2-LTS, 12.04.3-LTS, 12.04.4-LTS, 12.04.5-LTS, 12.10, 14.04.2-LTS, 14.10, 15.04."
}
}
},
"variables": {
"extensionName": "ELKSimple",
"location": "West Europe",
"imagePublisher": "Canonical",
"imageOffer": "UbuntuServer",
"OSDiskName": "osdiskforlinuxsimple",
"nicName": "elk-simple-on-ubuntu-nic",
"addressPrefix": "10.0.0.0/16",
"subnetName": "Subnet",
"subnetPrefix": "10.0.0.0/24",
"storageAccountType": "Standard_LRS",
"publicIPAddressType": "Dynamic",
"vmStorageAccountContainerName": "vhds",
"vmName": "MyUbuntuVM",
"vmSize": "Standard_D1",
"virtualNetworkName": "MyVNET",
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks',variables('virtualNetworkName'))]",
"subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]"
},
"resources": [
{
"type": "Microsoft.Storage/storageAccounts",
"name": "[parameters('newStorageAccountName')]",
"apiVersion": "2015-05-01-preview",
"location": "[variables('location')]",
"tags": {
"displayName": "StorageAccount"
},
"properties": {
"accountType": "[variables('storageAccountType')]"
}
},
{
"apiVersion": "2015-05-01-preview",
"type": "Microsoft.Network/publicIPAddresses",
"name": "[parameters('dnsNameForPublicIP')]",
"location": "[variables('location')]",
"tags": {
"displayName": "PublicIPAddress"
},
"properties": {
"publicIPAllocationMethod": "[variables('publicIPAddressType')]",
"dnsSettings": {
"domainNameLabel": "[parameters('dnsNameForPublicIP')]"
}
}
},
{
"apiVersion": "2015-05-01-preview",
"type": "Microsoft.Network/virtualNetworks",
"name": "[variables('virtualNetworkName')]",
"location": "[variables('location')]",
"tags": {
"displayName": "VirtualNetwork"
},
"properties": {
"addressSpace": {
"addressPrefixes": [
"[variables('addressPrefix')]"
]
},
"subnets": [
{
"name": "[variables('subnetName')]",
"properties": {
"addressPrefix": "[variables('subnetPrefix')]"
}
}
]
}
},
{
"apiVersion": "2015-05-01-preview",
"type": "Microsoft.Network/networkInterfaces",
"name": "[variables('nicName')]",
"location": "[variables('location')]",
"tags": {
"displayName": "NetworkInterface"
},
"dependsOn": [
"[concat('Microsoft.Network/publicIPAddresses/', parameters('dnsNameForPublicIP'))]",
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]"
],
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIPAddresses',parameters('dnsNameForPublicIP'))]"
},
"subnet": {
"id": "[variables('subnetRef')]"
}
}
}
]
}
},
{
"apiVersion": "2015-05-01-preview",
"type": "Microsoft.Compute/virtualMachines",
"name": "[variables('vmName')]",
"location": "[variables('location')]",
"tags": {
"displayName": "VirtualMachine"
},
"dependsOn": [
"[concat('Microsoft.Storage/storageAccounts/', parameters('newStorageAccountName'))]",
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]"
],
"properties": {
"hardwareProfile": {
"vmSize": "[variables('vmSize')]"
},
"osProfile": {
"computername": "[variables('vmName')]",
"adminUsername": "[parameters('adminUsername')]",
"adminPassword": "[parameters('adminPassword')]"
},
"storageProfile": {
"imageReference": {
"publisher": "[variables('imagePublisher')]",
"offer": "[variables('imageOffer')]",
"sku": "[parameters('ubuntuOSVersion')]",
"version": "latest"
},
"osDisk": {
"name": "osdisk",
"vhd": {
"uri": "[concat('http://',parameters('newStorageAccountName'),'.blob.core.windows.net/',variables('vmStorageAccountContainerName'),'/',variables('OSDiskName'),'.vhd')]"
},
"caching": "ReadWrite",
"createOption": "FromImage"
}
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces',variables('nicName'))]"
}
]
}
}
},
{
"type": "Microsoft.Compute/virtualMachines/extensions",
"name": "[concat(variables('vmName'),'/', variables('extensionName'))]",
"apiVersion": "2015-05-01-preview",
"location": "[variables('location')]",
"dependsOn": [
"[concat('Microsoft.Compute/virtualMachines/', variables('vmName'))]"
],
"properties": {
"publisher": "Microsoft.OSTCExtensions",
"type": "CustomScriptForLinux",
"typeHandlerVersion": "1.2",
"settings": {
"fileUris": [ "https://gist.githubusercontent.com/Nosmadas/d90d30c7c54bcfaba86aee903bd45b50/raw/5d48b62b6c7670a3bdaf2f6f75ec6c4e53873d24/logstashBash.sh" ],
"commandToExecute": "[concat('bash ./logstashBash.sh -e ', parameters('encodedConfigString'))]"
}
}
}
]
}
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"encodedConfigString": {
"value": "aW5wdXQgeyAgICAgYXp1cmV3YWR0YWJsZSB7ICAgICBhY2NvdW50X25hbWUgPT4gImxvZ3N0YXNod2Fkc3RvcmUiICAgICBhY2Nlc3Nfa2V5ID0+ICJGdEkzanVnRVRsQUM5SVhZWlZBSGdiYW44UkhVMS9weW9sRW9GTEtZbmhDUDVySzY1bHllMTRCZW9Ea0EzdW1DWjI1WUN5YnhYN2pHNlUzcjh0VllQUT09IiAgICAgdGFibGVfbmFtZSA9PiAiV0FERGlhZ25vc3RpY0luZnJhc3RydWN0dXJlTG9nc1RhYmxlIiAgICAgfSB9ICBvdXRwdXQgeyAgICBhcHBsaWNhdGlvbmluc2lnaHRzICAgICB7ICAgICAgICAgaWtleSA9PiAiMTU1NzAwODctOGE5Ni00ZTU0LWIwYzQtOTdiZjEyNjE1NmQ3IiAgICAgICAgIGFpX3R5cGUgPT4gdHJhY2UgICAgICAgICBkZXZfbW9kZSA9PiB0cnVlICAgICAgICAgYWlfbWVzc2FnZV9maWVsZCA9PiAiTWVzc2FnZSIgICAgICAgICBhaV9zZXZlcml0eV9sZXZlbF9maWVsZCA9PiAic2V2ZXJpdHlMZXZlbCIgICAgICAgICBhaV9zZXZlcml0eV9sZXZlbF9tYXBwaW5nID0+IHsgNSA9PiAwIDQgPT4gMSAzID0+IDIgMiA9PiAzIDEgPT4gNCAwID0+IDQgfSAgICAgfSB9"
},
"adminUsername": {
"value": "ops"
},
"adminPassword": {
"value": ""
},
"newStorageAccountName": {
"value": "logstashstorazn"
},
"dnsNameForPublicIP": {
"value": "logstapublicipdns"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment