Moodle/nested/glustervm.json

213 строки
9.4 KiB
JSON

{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"counter": {
"metadata": {
"description": "from the copyindex function of calling template"
},
"type": "int"
},
"moodleCommon": {
"metadata": {
"description": "Common Moodle values"
},
"type": "object"
}
},
"resources": [
{
"apiVersion": "2015-05-01-preview",
"location": "[resourceGroup().location]",
"name": "[variables('nicName')]",
"properties": {
"ipConfigurations": [
{
"name": "ipcfggfs",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"subnet": {
"id": "[variables('subnetSanRef')]"
}
}
}
]
},
"tags": {
"displayName": "Gluster VM NIC"
},
"type": "Microsoft.Network/networkInterfaces"
},
{
"apiVersion": "[parameters('moodleCommon').computeApi]",
"copy": {
"count": "[parameters('moodleCommon').fileServerDiskCount]",
"name": "[variables('diskLoop')]"
},
"location": "[resourceGroup().location]",
"name": "[concat(variables('vmName'),'-datadisk',copyIndex(1))]",
"properties": {
"accountType": "Premium_LRS",
"creationData": {
"createOption": "Empty"
},
"diskSizeGB": "[parameters('moodleCommon').fileServerDiskSize]"
},
"tags": {
"displayName": "Gluster VM Data Disk"
},
"type": "Microsoft.Compute/disks"
},
{
"apiVersion": "2015-01-01",
"dependsOn": [
"[variables('diskLoop')]"
],
"name": "[concat(variables('vmName'),'-diskSelection')]",
"properties": {
"mode": "Incremental",
"parameters": {
"vmDiskCount": {
"value": "[parameters('moodleCommon').fileServerDiskCount]"
},
"vmName": {
"value": "[variables('vmName')]"
}
},
"templateLink": {
"uri": "[concat(parameters('moodleCommon').baseTemplateUrl,'diskSelection.json',parameters('moodleCommon').artifactsSasToken)]"
}
},
"type": "Microsoft.Resources/deployments"
},
{
"apiVersion": "[parameters('moodleCommon').computeApi]",
"dependsOn": [
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]",
"[concat('Microsoft.Resources/deployments/',concat(variables('vmName'),'-diskSelection'))]"
],
"location": "[resourceGroup().location]",
"name": "[variables('vmName')]",
"properties": {
"availabilitySet": {
"id": "[variables( 'asRef')]"
},
"hardwareProfile": {
"vmSize": "[parameters('moodleCommon').glusterVmSku]"
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[variables('nicRef')]"
}
]
},
"osProfile": {
"adminUsername": "[parameters('moodleCommon').sshUsername]",
"computerName": "[variables('vmName')]",
"linuxConfiguration": {
"disablePasswordAuthentication": true,
"ssh": {
"publicKeys": [
{
"path": "[concat('/home/', parameters('moodleCommon').sshUsername, '/.ssh/authorized_keys')]",
"keyData": "[parameters('moodleCommon').sshPublicKey]"
}
]
}
}
},
"storageProfile": {
"dataDisks": "[reference(concat(variables('vmName'),'-diskSelection')).outputs.dataDiskArray.value]",
"imageReference": "[parameters('moodleCommon').osType]",
"osDisk": {
"createOption": "FromImage",
"managedDisk": {
"storageAccountType": "Premium_LRS"
},
"name": "[variables('vmName')]"
}
}
},
"tags": {
"displayName": "Gluster Virtual Machine"
},
"type": "Microsoft.Compute/virtualMachines"
},
{
"condition": "[parameters('moodleCommon').applyScriptsSwitch]",
"apiVersion": "2015-01-01",
"dependsOn": [
"[concat('Microsoft.Compute/virtualMachines/',variables('vmName'))]"
],
"name": "[concat(variables('vmName'),'-ScriptProcessor')]",
"properties": {
"mode": "Incremental",
"parameters": {
"moodleCommon": {
"value": "[parameters('moodleCommon')]"
},
"vmName": {
"value": "[ variables('vmName')]"
},
"vmNumber": {
"value": "[parameters('counter')]"
}
},
"templateLink": {
"uri": "[concat(parameters('moodleCommon').baseTemplateUrl,'glustervmconfig.json',parameters('moodleCommon').artifactsSasToken)]"
}
},
"type": "Microsoft.Resources/deployments"
},
{
"condition": "[parameters('moodleCommon').azureBackupSwitch]",
"apiVersion": "2015-01-01",
"dependsOn": [
"[concat('Microsoft.Compute/virtualMachines/',variables('vmName'))]"
],
"name": "[concat(variables('vmName'),'-Backup')]",
"properties": {
"mode": "Incremental",
"parameters": {
"moodleCommon": {
"value": "[parameters('moodleCommon')]"
},
"vmName": {
"value": "[variables('vmName')]"
}
},
"templateLink": {
"uri": "[concat(parameters('moodleCommon').baseTemplateUrl,'recoveryservicesEnlist.json',parameters('moodleCommon').artifactsSasToken)]"
}
},
"type": "Microsoft.Resources/deployments"
}
],
"variables": {
"asRef": "[ resourceId('Microsoft.Compute/availabilitySets', parameters('moodleCommon').gfxAvailabilitySetName)]",
"diskLoop": "[concat(variables('vmName'),'-disk')]",
"documentation01": "This sub-template create the nodes of the gluster farm",
"documentation02": "It expects certain values in the 'common' datastructure.",
"documentation03": " computeApi - the 'managed' resources need to all use this value",
"documentation04": " gfxAvailabilitySetName - name of availability set for the gluster farm",
"documentation05": " vnetName - name of virtual network",
"documentation06": " subnetSan - name of subnet for gluster",
"documentation07": " gfsNameRoot - nameroot for the gluster nodes - combined with counter to get actual name of each node - disk and nic follow the naming scheme",
"documentation08": " glusterVmSku - VM instance size for gluster nodes",
"documentation09": " sshUsername - OS accountusername",
"documentation10": " sshPassword - OS account password",
"documentation11": " osType - an array of value that specifies the type of VM",
"documentation15": "This sub-template calls other sub-templates",
"documentation16": " diskSelection - returns an arry of disk names - for flexible sizing",
"documentation17": " glustervmconfig - conditionally applies post-deployment script on the VM",
"documentation18": " recoveryservicesEnlist - conditionally enlists the VM into the backup regimen",
"documentation19": " fileServerDiskCount - Number of disks to raid0 for the gluster mount",
"documentation20": " fileServerDiskSize - Size per disk for gluster",
"nicName": "[concat(variables('vmName'),'-nic')]",
"nicRef": "[resourceId('Microsoft.Network/networkInterfaces', variables('nicName'))]",
"subnetSanRef": "[concat(resourceId('Microsoft.Network/virtualNetworks', parameters('moodleCommon').vnetName), '/subnets/',parameters('moodleCommon').subnetSan)]",
"vmName": "[concat(parameters('moodleCommon').gfsNameRoot,parameters('counter'))]"
}
}