129 строки
5.0 KiB
JSON
129 строки
5.0 KiB
JSON
{
|
|
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json#",
|
|
"contentVersion": "1.0.0.0",
|
|
"parameters": {
|
|
"dnsNamePrefix": {
|
|
"type": "string"
|
|
},
|
|
"region": {
|
|
"type": "string"
|
|
},
|
|
"scriptsUri": {
|
|
"type": "string"
|
|
},
|
|
"nodeTemplateUri": {
|
|
"type": "string"
|
|
},
|
|
"storageAccount" : {
|
|
"type": "object"
|
|
},
|
|
"vmSize": {
|
|
"type": "string"
|
|
},
|
|
"vmCount": {
|
|
"type":"int"
|
|
},
|
|
"vmSpec": {
|
|
"type": "object"
|
|
},
|
|
"networkSpec": {
|
|
"type": "object"
|
|
},
|
|
"clusterSpec": {
|
|
"type": "object"
|
|
}
|
|
},
|
|
"variables": {
|
|
"vmName": "[concat(parameters('dnsNamePrefix'), '-mn-')]",
|
|
"storageAccountName": "[concat(parameters('storageAccount').prefix, 'mn')]"
|
|
},
|
|
"resources": [
|
|
{
|
|
"type": "Microsoft.Storage/storageAccounts",
|
|
"name": "[concat(variables('storageAccountName'), copyIndex(2))]",
|
|
"apiVersion": "2015-05-01-preview",
|
|
"location": "[parameters('region')]",
|
|
"copy": {
|
|
"name": "storageAccountLoop",
|
|
"count": "[parameters('vmCount')]"
|
|
},
|
|
"properties": {
|
|
"accountType": "[parameters('storageAccount').type]"
|
|
}
|
|
},
|
|
{
|
|
"name": "[concat(variables('vmName'), copyIndex(2))]",
|
|
"type": "Microsoft.Resources/deployments",
|
|
"apiVersion": "2015-01-01",
|
|
"copy": {
|
|
"name": "nameNodeNicLoop",
|
|
"count": "[parameters('vmCount')]"
|
|
},
|
|
"dependsOn": [
|
|
"[concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'), copyIndex(2))]"
|
|
],
|
|
"properties": {
|
|
"mode": "Incremental",
|
|
"templateLink": {
|
|
"uri": "[parameters('nodeTemplateUri')]",
|
|
"contentVersion": "1.0.0.0"
|
|
},
|
|
"parameters": {
|
|
"vmName": {
|
|
"value": "[concat(variables('vmName'), copyIndex(2))]"
|
|
},
|
|
"region": {
|
|
"value": "[parameters('region')]"
|
|
},
|
|
"availabilitySet": {
|
|
"value": "[parameters('vmSpec').masterNodeASName]"
|
|
},
|
|
"storageAccountName" : {
|
|
"value": "[concat(variables('storageAccountName'), copyIndex(2))]"
|
|
},
|
|
"subnetResourceId": {
|
|
"value": "[concat(resourceId('Microsoft.Network/virtualNetworks',parameters('networkSpec').virtualNetworkName), '/subnets/', parameters('networkSpec').virtualNetworkSubnetName)]"
|
|
},
|
|
"dnsName": {
|
|
"value": "[concat(parameters('dnsNamePrefix'), '-mn-', copyIndex(2))]"
|
|
},
|
|
"ipAddress": {
|
|
"value": "[concat(parameters('networkSpec').privateIPPrefix, copyIndex(parameters('networkSpec').nameNodeAddressStart))]"
|
|
},
|
|
"vmSize": {
|
|
"value": "[parameters('vmSize')]"
|
|
},
|
|
"vmSpec": {
|
|
"value": "[parameters('vmSpec')]"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "Microsoft.Compute/virtualMachines/extensions",
|
|
"name": "[concat(variables('vmName'), copyIndex(2), '/prepareDisks')]",
|
|
"apiVersion": "2015-05-01-preview",
|
|
"location": "[parameters('region')]",
|
|
"copy": {
|
|
"name": "nameNodeNicLoop",
|
|
"count": "[parameters('vmCount')]"
|
|
},
|
|
"dependsOn": [
|
|
"[concat('Microsoft.Resources/deployments/', variables('vmName'), copyIndex(2))]"
|
|
],
|
|
"properties": {
|
|
"publisher": "Microsoft.OSTCExtensions",
|
|
"type": "CustomScriptForLinux",
|
|
"typeHandlerVersion": "1.2",
|
|
"settings": {
|
|
"fileUris": [
|
|
"[concat(parameters('scriptsUri'), '/scripts/initialize-node.sh')]",
|
|
"[concat(parameters('scriptsUri'), '/scripts/vm-bootstrap.py')]"
|
|
],
|
|
"commandToExecute": "[concat('sh initialize-node.sh \"', parameters('networkSpec').privateIPPrefix, '\" \"', parameters('dnsNamePrefix'), '\" \"', reference(concat(variables('vmName'), copyIndex(2))).outputs.fqdn.value, '\" ', parameters('clusterSpec').nameNodeCount, ' ', parameters('clusterSpec').dataNodeCount)]"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|