Permalink
Find file Copy path
129 lines (128 sloc) 5.16 KB
"$schema": https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#
contentVersion: 1.0.0.0
parameters:
adminUsername:
type: string
metadata:
description: Admin username used when provisioning virtual machines
authSet:
type: object
metadata:
description: Authentication information
storageSettings:
type: object
metadata:
description: Storage Account Settings
subnet:
type: object
metadata:
description: The name of the subnet to deploy resources into
vmSize:
type: string
defaultValue: Standard_A1
metadata:
description: Size of the Elasticsearch data nodes
vmCount:
type: int
defaultValue: 2
metadata:
description: Number of Elasticsearch data nodes
osSettings:
type: object
metadata:
description: OS settings to deploy on
dataDiskSize:
type: int
defaultValue: 1023
metadata:
description: Size of each data disk attached to data nodes in (Gb)
namespace:
type: string
metadata:
description: The namespace for resources created by this template
lbBackendPools:
type: object
metadata:
description: loadBalancerBackendAddressPools config object
variables:
vmStorageAccountContainerName: vhd
subnetRef: "[concat(resourceId('Microsoft.Network/virtualNetworks', parameters('subnet').vnet), '/subnets/', parameters('subnet').name)]"
storageAccountName: "[parameters('storageSettings').prefix]"
storageAccountNameAFS: "[parameters('storageSettings').afs]"
vmName: "[concat(parameters('namespace'), '-vm')]"
resources:
- apiVersion: '2015-06-15'
type: Microsoft.Compute/availabilitySets
name: "es-data-set"
location: "[resourceGroup().location]"
properties:
platformUpdateDomainCount: 20
platformFaultDomainCount: 3
- apiVersion: '2016-03-30'
type: Microsoft.Network/networkInterfaces
name: "[concat(parameters('namespace'), '-nic', copyindex())]"
location: "[resourceGroup().location]"
copy:
name: "[concat(parameters('namespace'),'nicLoop')]"
count: "[parameters('vmCount')]"
properties:
ipConfigurations:
- name: ipconfig1
properties:
privateIPAllocationMethod: Dynamic
subnet:
id: "[variables('subnetRef')]"
loadBalancerBackendAddressPools: "[parameters('lbBackendPools').backendPools]"
- apiVersion: '2015-06-15'
type: Microsoft.Compute/virtualMachines
name: "[concat(variables('vmName'), copyindex())]"
location: "[resourceGroup().location]"
copy:
name: "[concat(parameters('namespace'), 'virtualMachineLoop')]"
count: "[parameters('vmCount')]"
dependsOn:
- "[resourceId('Microsoft.Network/networkInterfaces', concat(parameters('namespace'), '-nic', copyindex()))]"
- "[resourceId('Microsoft.Compute/availabilitySets', 'es-data-set')]"
properties:
availabilitySet:
id: "[resourceId('Microsoft.Compute/availabilitySets', 'es-data-set')]"
hardwareProfile:
vmSize: "[parameters('vmSize')]"
osProfile:
computerName: "[concat('data-vm', copyIndex())]"
adminUsername: "[parameters('adminUsername')]"
adminPassword: "[parameters('authSet').password]"
linuxConfiguration: "[parameters('osSettings').linuxConfiguration]"
storageProfile:
imageReference: "[parameters('osSettings').imageReference]"
osDisk:
name: osdisk
vhd:
uri: "[concat(reference(resourceId('Microsoft.Storage/storageAccounts', concat(variables('storageAccountName'), parameters('storageSettings').mapping[copyindex()])), '2016-01-01').primaryEndpoints.blob, 'vhds/', variables('vmName'), copyindex(), '-osdisk.vhd')]"
caching: ReadWrite
createOption: FromImage
dataDisks:
- name: datadisk::index
diskSizeGB: "[parameters('dataDiskSize')]"
lun: 0
vhd:
uri: "[concat(reference(resourceId('Microsoft.Storage/storageAccounts', concat(variables('storageAccountName'), parameters('storageSettings').mapping[copyindex()])), '2016-01-01').primaryEndpoints.blob, variables('vmStorageAccountContainerName'), '/', parameters('namespace'), 'vm', copyindex(), 'dataDisk::index', '.vhd')]"
caching: None
createOption: Empty
networkProfile:
networkInterfaces:
- id: "[resourceId('Microsoft.Network/networkInterfaces', concat(parameters('namespace'),'-nic', copyindex()))]"
resources:
- type: extensions
name: "installelasticsearch"
apiVersion: '2015-06-15'
location: "[resourceGroup().location]"
dependsOn:
- "[resourceId('Microsoft.Compute/virtualMachines/', concat(variables('vmName'), copyindex()))]"
properties:
publisher: "[parameters('osSettings').extensionSettings.data.publisher]"
type: "[parameters('osSettings').extensionSettings.data.type]"
typeHandlerVersion: "[parameters('osSettings').extensionSettings.data.typeHandlerVersion]"
settings:
fileUris: "[parameters('osSettings').extensionSettings.data.settings.fileUris]"
commandToExecute: "[concat(parameters('osSettings').extensionSettings.data.settings.commandToExecute, listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountNameAFS')), '2016-01-01').keys[0].value)]"