This article describes how you can use vCommander® to automatically tag deployed VMs with their server roles, contributing to greater reporting efficiency and providing a solid base for even more powerful automation options. While the example throughout is specific to server roles, the same process is applicable to any kind of metadata tagging you wish to employ.


Creating a Custom Attribute


Custom attributes are used to add useful metadata to VMs managed by vCommander. In this case, we want to record the Primary Role for VMs. Follow the steps below to create an appropriate custom attribute. 

  1. Under the Configuration menu, choose Custom Attributes. Click Add
  2. Enter Server Role as the Name and provide a Description if you wish. 
  3. Choose Applies To: VMs 
  4. Choose Type: List
  5. Uncheck Edit in Service Portal. Click Next.
  6. Add values to your list and use the Move Up / Move Down to sort the list (useful if anyone will ever manually set these values). Click Finish.



Configuring VM Details


The next step is to configure the VM details which appear when viewing a VM in either vCommander or the Service Portal. If you are only concerned with server role for reporting purposes, and don't need it displayed to users, you can skip ahead to the next section. 

  1. On the Summary tab for any VM, clickin the Details section. 
  2. From the Hidden Properties list, select Custom Attributes > Server Role.
  3. Click Add to move it to the Shown Properties list. Use the Move Up / Move Down buttons to position it in the list appropriately (the same order will be used in the UI). Click OK.

Setting the Descriptions in Service Catalog


In order to determine which server role to apply to each VM that gets deployed, vCommander needs a means to evaluate them as they are deployed. vCommander's extensive variables provide more than one way to do this, but for simplicity's sake we'll look at the most straightforward example using the variable #{component.description} which returns the component's description from the service catalog. This means you must add specific strings to the component descriptions as you add services to the catalog, and update existing services as well. 


For each component in a service that you want tagged with server role, you must add a Description on its component page.



Using the example above, the variable #{component.description} will return Exchange Server.


Adding Completion Workflow Steps


Next, you will add some conditional steps to set the custom attributes in your completion workflow(s). For each possible value available for the custom attribute, you will need a conditional workflow step. 

  1. On the Steps page of your completion workflow, click Add > Lifecycle Management > Set Custom Attribute
  2. Change the Step Name to Identify Exchange
  3. Change Step Execution to Execute when conditions are met and enter: #{component.description} -contains Exchange 
  4. Click OK
  5. Scroll down the list of custom attributes, and choose the matching value for Server Role.


  6. Repeat for each variable, naming steps and setting conditions which all match. Complete the wizard and click Finish


As you deploy VMs that will use this completion workflow, vCommander will check the descriptions set on the source components in the service catalog, and tag the VM with the appropriate value for the custom variable.


Searching by Role


With this in place, you can filter searches and reports to include or exclude VMs based on their server role.