216 строки
7.4 KiB
JSON
216 строки
7.4 KiB
JSON
{
|
|
"$schema": "http://schema.management.azure.com/schemas/2015-01-01-preview/deploymentTemplate.json",
|
|
"contentVersion": "1.0.0.0",
|
|
"parameters" : {
|
|
"newStorageAccountName": {
|
|
"type": "string"
|
|
},
|
|
"dnsNameForPublicIP" : {
|
|
"type" : "string"
|
|
},
|
|
"adminUserName": {
|
|
"type": "string"
|
|
},
|
|
"adminPassword": {
|
|
"type": "securestring"
|
|
},
|
|
"imagePublisher": {
|
|
"type": "string",
|
|
"defaultValue": "OpenLogic",
|
|
"metadata": {
|
|
"Description": "Image Publisher"
|
|
}
|
|
},
|
|
"imageOffer": {
|
|
"type": "string",
|
|
"defaultValue": "CentOS",
|
|
"metadata": {
|
|
"Description": "Image Offer"
|
|
}
|
|
},
|
|
"imageSKU": {
|
|
"type": "string",
|
|
"defaultValue": "7.0",
|
|
"metadata": {
|
|
"Description": "Image SKU"
|
|
}
|
|
},
|
|
"location": {
|
|
"type": "String",
|
|
"defaultValue" : "West US"
|
|
},
|
|
"vmSize": {
|
|
"type": "string",
|
|
"defaultValue": "Standard_A0"
|
|
},
|
|
"publicIPAddressName": {
|
|
"type": "string",
|
|
"defaultValue" : "myPublicIP"
|
|
},
|
|
"vmName": {
|
|
"type": "string",
|
|
"defaultValue" : "myLinuxVM"
|
|
},
|
|
"virtualNetworkName":{
|
|
"type" : "string",
|
|
"defaultValue" : "myVNET"
|
|
},
|
|
"nicName":{
|
|
"type" : "string",
|
|
"defaultValue":"myNIC"
|
|
}
|
|
},
|
|
"variables": {
|
|
"addressPrefix":"10.0.0.0/16",
|
|
"subnet1Name": "Subnet-1",
|
|
"subnet2Name": "Subnet-2",
|
|
"subnet1Prefix" : "10.0.0.0/24",
|
|
"subnet2Prefix" : "10.0.1.0/24",
|
|
"vmStorageAccountContainerName": "vhds",
|
|
"publicIPAddressType" : "Dynamic",
|
|
"storageAccountType": "Standard_LRS",
|
|
"vnetID":"[resourceId('Microsoft.Network/virtualNetworks',parameters('virtualNetworkName'))]",
|
|
"subnet1Ref" : "[concat(variables('vnetID'),'/subnets/',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": "[parameters('publicIPAddressName')]",
|
|
"location": "[parameters('location')]",
|
|
"properties": {
|
|
"publicIPAllocationMethod": "[variables('publicIPAddressType')]",
|
|
"dnsSettings": {
|
|
"domainNameLabel": "[parameters('dnsNameForPublicIP')]"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"apiVersion": "2015-05-01-preview",
|
|
"type": "Microsoft.Network/virtualNetworks",
|
|
"name": "[parameters('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": "[parameters('nicName')]",
|
|
"location": "[parameters('location')]",
|
|
"dependsOn": [
|
|
"[concat('Microsoft.Network/publicIPAddresses/', parameters('publicIPAddressName'))]",
|
|
"[concat('Microsoft.Network/virtualNetworks/', parameters('virtualNetworkName'))]"
|
|
],
|
|
"properties": {
|
|
"ipConfigurations": [
|
|
{
|
|
"name": "ipconfig1",
|
|
"properties": {
|
|
"privateIPAllocationMethod": "Dynamic",
|
|
"publicIPAddress": {
|
|
"id": "[resourceId('Microsoft.Network/publicIPAddresses',parameters('publicIPAddressName'))]"
|
|
},
|
|
"subnet": {
|
|
"id": "[variables('subnet1Ref')]"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"apiVersion": "2015-05-01-preview",
|
|
"type": "Microsoft.Compute/virtualMachines",
|
|
"name": "[parameters('vmName')]",
|
|
"location": "[parameters('location')]",
|
|
"dependsOn": [
|
|
"[concat('Microsoft.Storage/storageAccounts/', parameters('newStorageAccountName'))]",
|
|
"[concat('Microsoft.Network/networkInterfaces/', parameters('nicName'))]"
|
|
],
|
|
"properties": {
|
|
"hardwareProfile": {
|
|
"vmSize": "[parameters('vmSize')]"
|
|
},
|
|
"osProfile": {
|
|
"computername": "[parameters('vmName')]",
|
|
"adminUsername": "[parameters('adminUsername')]",
|
|
"adminPassword": "[parameters('adminPassword')]"
|
|
},
|
|
"storageProfile": {
|
|
"imageReference": {
|
|
"publisher": "[parameters('imagePublisher')]",
|
|
"offer": "[parameters('imageOffer')]",
|
|
"sku" : "[parameters('imageSKU')]",
|
|
"version":"latest"
|
|
},
|
|
"osDisk" : {
|
|
"name": "osdisk1",
|
|
"vhd": {
|
|
"uri": "[[concat('http://',parameters('newStorageAccountName'),'.blob.core.windows.net/',variables('vmStorageAccountContainerName'),'/','osdisk1spec.vhd')]"
|
|
},
|
|
"caching": "ReadWrite",
|
|
"createOption": "FromImage"
|
|
}
|
|
|
|
},
|
|
"networkProfile": {
|
|
"networkInterfaces" : [
|
|
{
|
|
"id": "[resourceId('Microsoft.Network/networkInterfaces',parameters('nicName'))]"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "Microsoft.Compute/virtualMachines/extensions",
|
|
"name": "[concat(parameters('vmName'),'/installmongo')]",
|
|
"apiVersion": "2015-05-01-preview",
|
|
"location": "[parameters('location')]",
|
|
"dependsOn": [
|
|
"[concat('Microsoft.Compute/virtualMachines/', parameters('vmName'))]"
|
|
],
|
|
"properties": {
|
|
"publisher": "Microsoft.OSTCExtensions",
|
|
"type": "CustomScriptForLinux",
|
|
"typeHandlerVersion": "1.2",
|
|
"settings": {
|
|
"fileUris": [
|
|
"https://raw.githubusercontent.com/azurermtemplates/azurermtemplates/master/mongodb-on-centos/mongo-install-centos.sh"
|
|
],
|
|
"commandToExecute": "sh mongo-install-centos.sh"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|