다음을 통해 공유


Using Services Templates in System Center Virtual Machine Manager 2012

Introduction

The problem:

Before we begin, to help understanding the article, consider the following questions:

• How long do you take to install a server and leave it ready to be used in production environment?
• How long do you take to configure a server that will be used as a database or a web application, for example?
• What about complexity? For example, a developer or a help desk analyst can do this installation and setup alone?
• What about in case you need to do that, there is some process in your company to guide you?

These are some dilemma examples that some network administrators have to install a server, or prepare an environment for an application, for example. Imagine that you must install and configure three servers: Database Server, Application server and Web server. Now think about the bureaucracy that exists in large companies: Purchase of Hardware, test environment, resources analysis usage and several other impediments that may make the wait pass months.
Small companies also have this problem too. Some examples are the lack of processes, resources scarce and underutilized, etc..

The solution:

In a virtualized structure we have already achieved a lot to resolve those problems such as balancing overload, misuse of resources, energy consumption, complexity of installation, etc., but without management virtualization is also somewhat complex. It is very important to provide centralized management and automation for virtualization.
Those are the core concepts of ​​System Center Virtual Machine Manager 2012 (VMM Server): virtual environment automation, management and monitoring. With it we can create templates for automatic creation and configuration of virtual machines.
There is a new type of template called Service Template.  With it is possible to add some virtual machines templates, network configuration, applications and storage in a single object, a kind of parent template with multiple child templates. The result? Rather than explain, I am going with the article demonstrate the installation and configuration of a database, application and web server with just three clicks. Don’t you believe me? Then check out:

Configuration

Before we begin you must already have created some templates of virtual machines, logical network configurations, load balancer, etc.. For more information about these settings, go to http://technet.microsoft.com/en-us/library/gg696967.aspx

In the example below we have some hosts, a logical network and three virtual machine (VM) templates with some applications and scripts configured.

To create the template, open the VMM server management console, click Library and then click Create Service Template, as shown in Figure 1.


Figure 1 - Option to create a Service Template

If you already have a template on the first screen it can be specified and used as the base. If you want to create a new or a blank one, type the template name and click OK.


Figure 2 - New Template

To facilitate the creation and configuration of the template it will be used a tool called Service Template Designer, providing some features and options to assist in this procedure. In the first column are displayed the VM Templates.


Figure 3 - Service Template Designer

With some templates you can now start creating a service. To do so, move the VM templates to the center of the Service Template Designer. In figure 4 you will see three templates that have been moved to our test environment. VMM automatically displays the settings and the network between them. If your environment has different networks or VLANs, select a new network with the Add Logical Network option.


Figure 4 - Hardware Configuration

The templates used above are connected to a network called Backend Network. During the creation of templates this network was selected as the default for any virtual machine created by it. Figure 5 displays the backend network and their configurations. Through a Logical Network you can assign  IP and MAC addresses Pool.


Figure 5 - Logical Networks

By clicking on the network object there is a menu to switch the network ( Figure 6). Below are listed the features that can be used in a Service Template:

*• Logical Networks
• Load Balancers
• Host Application Templates
• Connectors
• Host Application Templates
*
After creating and configuring the objects in the list above you can save or even longer install the service (more detail in Figure 6).


Figure 6 - Service Template

By clicking Configure Deployment the screen in figure 7 is shown asking the service name and host group that will host virtual machines. If a parent group with several subgroups and hosts is chosen VMM selects the best host to create the VMs. Also note from Figure 7 that it is possible to install the service to a Private Cloud.
**

**Figure 7 – Service Installation Destination

Before installing the service is displayed a preview of what will be done and several other settings are also validated. For example, if the VMM notices any conflict or problem in the options chosen a warning or error is displayed.
From Figure 8 the three servers based on the template are available, including the host who was chosen according to the VMM Server Ranking. If the service has some variable such as users, database names, passwords, etc., specify them in Settings.


Figure 8 - Deploy Service

To see the minimap as figure 9, click Tool Window.


Figure 9 – Service Minimap

Now just confirm the installation by clicking Deploy Service and Deploy. In the confirmation you can export the procedure to a Powershell script.


Figure 10 - Installation Confirmation

To get an idea of complexity involved in a simple service such as demonstrated above, note the number of jobs that are created by  in the figure 11.

Here are some tasks performed by the Service Template in this example automatically, without any human intervention:

• Windows Setup, Features and Roles
• Installation and configuration of SQL Server 2008 R2
• Installation and configuration of the application
• Installation of IIS Server
• Addition of three servers in the domain
• Configurations of local accounts and SQL
 


Figure 11 - Jobs

After about 25 minutes the three servers were installed, SQL and the database configured, the application and its communication with the defined SQL and IIS server were also installed and configured too.

See figure 12 three servers running.


Figure 12 - Virtual Machines created by the service

To implement another service or change existing ones, click on Library and Service Templates. With the right clicking on it you can change the properties and install a new service based on the template.


Figure 13 - Template Properties

Check out the application in production, noting that after the deployment of the service configuration no action were taken. Everything was done automatically by the Service Template.
**

**Figure 14 - Application. NET Pet Shop

Reference

This test environment was created based on the example given by the  System Center Virtual Machine Manager team via the link http://blogs.technet.com/b/m2/archive/2011/03/29/how-to-deploy-the-pet-shop-application-as-a-service-in-vmm.aspx

**Leandro Carvalho
**MCSA+S+M | MCSE+S | MCTS | MCITP | MCBMSS | MCT | MVP Virtual Machine
MSVirtualization | Wordpress | Winsec.org | LinhadeCodigo | MVP Profile
Twitter: LeandroEduardo | LinkedIn: Leandroesc