In my sandbox I often need to install a new server or a new server application for example SQL, IIS or Operations Manager. Unfortunaly I have never really learned how to use Configuration Manager to do that, deploy software and operating system. But lucky for me I have learned a bit about Virtual Machine Manager (VMM), Service Manager (SCSM) and Opalis. In this post I will describe for you how I deploy servers and apps in my sandbox.
The picture below show the policy I have for deploying new virtual servers. It includes a number of objects that first decide which VM host to use and then deploys the server. It all starts with a change request in Service manager. I will try to explain each step in the policy.
- The first object is from the Service Manager IP. I have built my own activity class in Service Manager, a deploy server activity. The new activity management pack includes a form where I can input VM Name, description and server type. Server type is a way to set which hardware to use, for example my DC machines will only get 1GB RAM. When a instance of this class gets in status “IN PROGRESS” Opalis will pick it up and start the policy. I have a blogpost here about writting a new custom activity class and integrate with Opalis, it also includes step how to use the new activity in a change request template.
- The following three objects is QMI Query objects. They query each of my Hyper-V Hosts for free memory. I want to deploy the new server to the host with most free RAM. Each of the WMI Query objects have a link to a Operations Manager object that will generate an alert if the policy cant query a machine for free RAM.
- Next item is a RUN .NET Script object. It runs a Powershell script. This script compare each of the hosts and returns the host with most free RAM. I guess I could solve it with a number of compare value objects, but it is easier with a script and it is only one object in the policy. As you can see in the beginning of the script I use DIV to get the free memory value in GB format.
- The “Map Published Data” object, Map Disk, is used to map which disk to use and which template to use. Depending on which Hyper-V server that has most free RAM, I want to use different logical disks. This object also map the server type fromthe Service Manager change request to a template in Virtual Machine Manager. The template controls what kind of hardware the virtual machine will get. For example if the server type is DC it will use a template with only 1 GB RAM.
- The “Create VM From Template” object connects to Virtual Machine Manager and creates the new virtual machine. I notice that when you work with this object, and want to test the connection to VMM, it does that from the machine where you run the console, not from the action server where you will run the policy. In my case my workstation did not have WS management installed, so the connection test failed. Instead I did that part from the Opalis server.
- The two “Update Activity” objects updates the change request in Service Manager. One if the machine cant be created and one if it worked out fine. As you can see in the picture I have updated the status of the change request and also added some info about where the virtual machine was created and which template that was used. All steps to update a change from Opalis is in this post.
Now when you have a easy way to create a new virtual machine the next step would be to install something on it, for example SQL server. This can also be done with Opalis 🙂 I have built a library of policies that each install small parts of a complete server. For example I have a policy to add the .NET Framework feature on a server.
I have another policy to unattend install SQL server. This policy first creates C:\temp, if the folder don’t exists. It then copy a INI file from a network file share. The INI file is the “answering” file for the SQL installation. It contains all the settings that you normally input manually during SQL installation. The policy then run the SQL setup, “D:\setup /ConfigurationFile=C:\temp\SQL2008R2_OPSMGR.ini /QUIET”. It is pretty easy to get the SQL unattend file, when you run the SQL setup wizard, on the last page you will see a path to a configuration file. You can copy that file direct from the path. The only thing I added to the INI file was “IAcceptSQLServerLicenseTerms=”TRUE””
When you have created your own library of policies that install and prepare machines you can create different “master workflows” that will create a new machine, install the application and configure the server for you. For example a “master policy” from installing a new Operations Manager server. This policy will then trigger the other policies. I use it almost every day in the sandbox and it saves me a lot of time. The policy below is a “master policy” for a new SQL server. It starts with a change request in Service Manager, it creates a new machine, run server setup to add for example .NET Framework and then it install SQL server. It finish by updating the change request. I have a notification in Service Manager that will notify me by e-mail when then machine is ready. If you want to take a look at the policy for the new machine, you can download it here 6.1 New Virtual Machine
Please note that this is provided “as is” with no warranties at all. Update: There is a extension to the VMM IP that you can download here
[…] This post was mentioned on Twitter by Aurélien BONNIN and JR52MAR, FAQShop. FAQShop said: [www.contoso.se] Deploying server and apps with Opalis, Service Manager and Virtual Machine Manager: In my sandb… http://bit.ly/hdDJO5 […]