From f26f74baf80e4fdef3101e0d2f2e0849705b4798 Mon Sep 17 00:00:00 2001 From: rolandsolace <35114344+rolandsolace@users.noreply.github.com> Date: Tue, 6 Feb 2018 09:59:13 -0500 Subject: [PATCH] [Bug 71519] Create linked template for workspaces with region selection --- README.md | 3 +- azuredeploy.json | 127 +++++++++++--------------------- azuredeploy.parameters.json | 7 +- metadata.json | 2 +- workspace-shared-resources.json | 122 ++++++++++++++++++++++++++++++ 5 files changed, 175 insertions(+), 86 deletions(-) create mode 100644 workspace-shared-resources.json diff --git a/README.md b/README.md index 07c41b1..7ad1de9 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,8 @@ The fields that you need to fill out are: | Admin Username | Username for the virtual Machine(s). Do not use special characters. | | Admin Password | Password for the virtual Machine(s) and for the 'admin' SolOS CLI user. | | Security Group Name | New or existing security group, where VMR default ports will be made publicly available. | -| Workspace Name | New or existing OMS Log Analytics workspace, where logs and diagnostics are monitored. Note that not all regions support workspaces. | +| Workspace Name | New or existing OMS Log Analytics workspace, where logs and diagnostics are monitored. | +| Workspace Region | Select region to deploy OMS Log Analytics workspace. | | DNS Label for LB IP | Used for the public DNS name of the Load Balancer. | | DNS Label for VM IP | Used for the public DNS name of each Virtual Machine(s). | | CentOS Version | The CentOS version for deploying the Docker containers. Use CentOS 7.2, 7.3, or 7.4. | diff --git a/azuredeploy.json b/azuredeploy.json index e1c4567..0321702 100644 --- a/azuredeploy.json +++ b/azuredeploy.json @@ -33,6 +33,23 @@ "description": "Unique OMS Workspace Name for Log Analytics." } }, + "workspaceRegion": { + "type": "string", + "defaultValue": "East US", + "metadata": { + "description": "OMS Workspace Region for Log Analytics." + }, + "allowedValues": [ + "East US", + "West Europe", + "Southeast Asia", + "Australia Southeast", + "Japan East", + "UK South", + "Central India", + "Canada Central" + ] + }, "dnsLabelForLbIp": { "type": "string", "metadata": { @@ -128,6 +145,8 @@ "securitySharedTemplateName": "security-shared-resources.json", "solaceLoadBalancerName": "SolaceLoadBalancer.Template", "loadBalancerSharedTemplateName": "loadbalancer-shared-resources.json", + "solaceWorkspaceName": "SolaceWorkspace.Template", + "workspaceSharedTemplateName": "workspace-shared-resources.json", "solaceInstallScriptName": "deploy_vmr.sh", "sempQueryScriptName": "semp_query.sh", "publicIPAddressName": "myPublicIPD", @@ -152,9 +171,6 @@ "lbID": "[resourceId('Microsoft.Network/loadBalancers',variables('lbName'))]", "lbPoolName": "vmr-ha-group", "lbPoolID": "[concat(variables('lbID'),'/backendAddressPools/',variables('lbPoolName'))]", - "workspaceTier": "Free", - "containersMarketplaceName": "Containers", - "syslogFacilities": [ "kern", "user", "daemon", "auth", "syslog", "uucp", "authpriv", "ftp", "cron", "local0", "local1", "local2", "local3", "local4", "local5", "local6", "local7" ], "dataDiskVolume" : "/dev/sdc", "dataDisksChoices": { "0": [ @@ -236,6 +252,26 @@ } } }, + { + "apiVersion": "2015-01-01", + "type": "Microsoft.Resources/deployments", + "name": "[variables('solaceWorkspaceName')]", + "properties": { + "mode": "Incremental", + "templateLink": { + "uri": "[concat(variables('scriptUrl'), variables('workspaceSharedTemplateName'))]", + "contentVersion": "1.0.0.0" + }, + "parameters": { + "workspaceName": { + "value": "[parameters('workspaceName')]" + }, + "workspaceRegion": { + "value": "[parameters('workspaceRegion')]" + } + } + } + }, { "apiVersion": "2016-03-30", "type": "Microsoft.Network/publicIPAddresses", @@ -294,6 +330,9 @@ "[concat('Microsoft.Resources/deployments/', variables('solaceLoadBalancerName'))]" ], "properties": { + "networkSecurityGroup": { + "id": "[resourceId('Microsoft.Network/networkSecurityGroups', parameters('securityGroupName'))]" + }, "ipConfigurations": [ { "name": "ipconfig1", @@ -409,82 +448,6 @@ "settings": { } } }, - { - "apiVersion": "2015-03-20", - "type": "Microsoft.OperationalInsights/workspaces", - "name": "[parameters('workspaceName')]", - "location": "[resourceGroup().location]", - "properties": { - "sku": { - "name": "[variables('workspaceTier')]" - } - }, - "resources": [ - { - "apiVersion": "2015-11-01-preview", - "type": "Microsoft.OperationalInsights/workspaces/datasources", - "name": "[concat(parameters('workspaceName'), '/syslogCollection')]", - "dependsOn": [ - "[concat('Microsoft.OperationalInsights/workspaces/', parameters('workspaceName'))]" - ], - "kind": "LinuxSyslogCollection", - "properties": { - "state": "Enabled" - } - } - ] - }, - { - "apiVersion": "2015-11-01-preview", - "type": "Microsoft.OperationalInsights/workspaces/datasources", - "name": "[concat(parameters('workspaceName'), '/syslog', copyindex())]", - "dependsOn": [ - "[concat('Microsoft.OperationalInsights/workspaces/', parameters('workspaceName'))]" - ], - "copy": { - "name": "SyslogFacilityLoop", - "count": "[length(variables('syslogFacilities'))]" - }, - "kind": "LinuxSyslog", - "properties": { - "syslogName": "[variables('syslogFacilities')[copyindex()]]", - "syslogSeverities": [ - { - "severity": "emerg" - }, - { - "severity": "alert" - }, - { - "severity": "crit" - }, - { - "severity": "err" - }, - { - "severity": "warning" - } - ] - } - }, - { - "apiVersion": "2015-11-01-preview", - "type": "Microsoft.OperationsManagement/solutions", - "name": "[concat(variables('containersMarketplaceName'), '(', parameters('workspaceName'), ')')]", - "location": "[resourceGroup().location]", - "dependsOn": [ - "[concat('Microsoft.OperationalInsights/workspaces/', parameters('workspaceName'))]" - ], - "properties": { - "workspaceResourceId": "[resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspaceName'))]" - }, - "plan": { - "name": "[concat(variables('containersMarketplaceName'), '(', parameters('workspaceName'), ')')]", - "publisher": "Microsoft", - "product": "[concat('OMSGallery/', variables('containersMarketplaceName'))]", - "promotionCode": "" - } - }, { "apiVersion": "2015-06-15", "type": "Microsoft.Compute/virtualMachines/extensions", @@ -496,17 +459,17 @@ }, "dependsOn": [ "[concat('Microsoft.Compute/virtualMachines/', variables('vmName'), copyindex(), '/extensions/DockerExtension')]", - "[concat('Microsoft.OperationalInsights/workspaces/', parameters('workspaceName'))]" + "[concat('Microsoft.Resources/deployments/', variables('solaceWorkspaceName'))]" ], "properties": { "publisher": "Microsoft.EnterpriseCloud.Monitoring", "type": "OmsAgentForLinux", "typeHandlerVersion": "1.4", "settings": { - "workspaceId": "[reference(resourceId('Microsoft.OperationalInsights/workspaces/', parameters('workspaceName')), '2015-03-20').customerId]" + "workspaceId": "[reference(variables('solaceWorkspaceName')).outputs.workspaceId.value]" }, "protectedSettings": { - "workspaceKey": "[listKeys(resourceId('Microsoft.OperationalInsights/workspaces/', parameters('workspaceName')), '2015-03-20').primarySharedKey]" + "workspaceKey": "[reference(variables('solaceWorkspaceName')).outputs.workspaceKey.value]" } } }, diff --git a/azuredeploy.parameters.json b/azuredeploy.parameters.json index e1df1b6..990f792 100644 --- a/azuredeploy.parameters.json +++ b/azuredeploy.parameters.json @@ -6,10 +6,10 @@ "value": "GEN-UNIQUE" }, "adminUsername": { - "value": "ubuntu" + "value": "solace" }, "adminPassword": { - "value": "P4$$w0rd" + "value": "GEN-PASSWORD" }, "workspaceName": { "value": "GEN-UNIQUE" @@ -19,6 +19,9 @@ }, "dnsLabelForVmIp": { "value": "GEN-UNIQUE" + }, + "deploymentModel": { + "value": "SingleNode" } } } \ No newline at end of file diff --git a/metadata.json b/metadata.json index 7053378..176e2c9 100644 --- a/metadata.json +++ b/metadata.json @@ -3,5 +3,5 @@ "description": "This template allows you to deploy either a standalone Solace Message Router or a three node High Availability cluster of Solace Message Routers onto Azure Linux VM(s).", "summary": "This template deploys either a standalone Solace Message Router or a three node High Availability cluster of Solace Message Routers onto Azure Linux VM(s).", "githubUsername": "KenBarr", - "dateUpdated": "31/01/2018" + "dateUpdated": "2018-01-31" } \ No newline at end of file diff --git a/workspace-shared-resources.json b/workspace-shared-resources.json new file mode 100644 index 0000000..6e418fa --- /dev/null +++ b/workspace-shared-resources.json @@ -0,0 +1,122 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "workspaceName": { + "type": "string", + "metadata": { + "description": "Unique OMS Workspace Name for Log Analytics." + } + }, + "workspaceRegion": { + "type": "string", + "defaultValue": "East US", + "metadata": { + "description": "OMS Workspace Region for Log Analytics." + }, + "allowedValues": [ + "East US", + "West Europe", + "Southeast Asia", + "Australia Southeast", + "Japan East", + "UK South", + "Central India", + "Canada Central" + ] + } + }, + "variables": { + "workspaceTier": "Free", + "containersMarketplaceName": "Containers", + "syslogFacilities": [ "kern", "user", "daemon", "auth", "syslog", "uucp", "authpriv", "ftp", "cron", "local0", "local1", "local2", "local3", "local4", "local5", "local6", "local7" ] + }, + "outputs": { + "workspaceId": { + "type": "string", + "value": "[reference(resourceId('Microsoft.OperationalInsights/workspaces/', parameters('workspaceName')), '2015-03-20').customerId]" + }, + "workspaceKey": { + "type": "string", + "value": "[listKeys(resourceId('Microsoft.OperationalInsights/workspaces/', parameters('workspaceName')), '2015-03-20').primarySharedKey]" + } + }, + "resources": [ + { + "apiVersion": "2015-03-20", + "type": "Microsoft.OperationalInsights/workspaces", + "name": "[parameters('workspaceName')]", + "location": "[parameters('workspaceRegion')]", + "properties": { + "sku": { + "name": "[variables('workspaceTier')]" + } + }, + "resources": [ + { + "apiVersion": "2015-11-01-preview", + "type": "Microsoft.OperationalInsights/workspaces/datasources", + "name": "[concat(parameters('workspaceName'), '/syslogCollection')]", + "dependsOn": [ + "[concat('Microsoft.OperationalInsights/workspaces/', parameters('workspaceName'))]" + ], + "kind": "LinuxSyslogCollection", + "properties": { + "state": "Enabled" + } + } + ] + }, + { + "apiVersion": "2015-11-01-preview", + "type": "Microsoft.OperationalInsights/workspaces/datasources", + "name": "[concat(parameters('workspaceName'), '/syslog', copyindex())]", + "dependsOn": [ + "[concat('Microsoft.OperationalInsights/workspaces/', parameters('workspaceName'))]" + ], + "copy": { + "name": "SyslogFacilityLoop", + "count": "[length(variables('syslogFacilities'))]" + }, + "kind": "LinuxSyslog", + "properties": { + "syslogName": "[variables('syslogFacilities')[copyindex()]]", + "syslogSeverities": [ + { + "severity": "emerg" + }, + { + "severity": "alert" + }, + { + "severity": "crit" + }, + { + "severity": "err" + }, + { + "severity": "warning" + } + ] + } + }, + { + "apiVersion": "2015-11-01-preview", + "type": "Microsoft.OperationsManagement/solutions", + "name": "[concat(variables('containersMarketplaceName'), '(', parameters('workspaceName'), ')')]", + "location": "[parameters('workspaceRegion')]", + "dependsOn": [ + "[concat('Microsoft.OperationalInsights/workspaces/', parameters('workspaceName'))]" + ], + "properties": { + "workspaceResourceId": "[resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspaceName'))]" + }, + "plan": { + "name": "[concat(variables('containersMarketplaceName'), '(', parameters('workspaceName'), ')')]", + "publisher": "Microsoft", + "product": "[concat('OMSGallery/', variables('containersMarketplaceName'))]", + "promotionCode": "" + } + } + ] +} \ No newline at end of file