Create and Assign VM Tagging via Dynamic Custom Properties using Property Toolkit

Brandon Miller
by Brandon Miller

Categories

Overview

This overview will help to utilize Property Toolkit mixed with the Sovlabs Template Engine to dynamically build a VM Tagging property to be assigned to a VM build.

Sovlabs VM Tagging Documentation Site

http://docs.sovlabs.com/latest/vRA/7.5/modules/vsphere/vm-tagging/

 

Standard VM Tagging Setup - http://docs.sovlabs.com/latest/vRA/7.5/modules/vsphere/vm-tagging/setup/#add-vra-property-group

 

Example Basic Tag

Property Name: SovLabs_CreateTags_VMW_Location

Property Value:

Single Object format

{   "name": "Atlanta",   "category": "Datacenter_Location",   "cardinalitySingle": false,   "categoryDescription": "Location of the Datacenter" }

 

Considerations

This example procedure will showcase how to set up a dynamic property group (SVL_ group) using Property Toolkit to dynamically build multiple "Single Object Format" VM Tags to be applied to the VM build. This guide will go over creating multiple custom properties that would be used inside a build. Those set properties can be replaced with other properties as needed.

 

Procedure

Determine the variables to be used in the Dynamic Property Group
  1. Log into the vRA environment and determine the properties that are going to be utilized to build the custom properties to use for the SVL_ property group.
    1. Table of Properties

      Property Value Description

      tagLocation

      LAB Custom Property Used for location setting of the VM. Assigned at the compute resource layer.

      tagUsage

      "{ Development | Production }" Custom Property Used for the usage setting of the VM. Selected by the user at build time.
      tagPatchSchedule

      "{ blank }"

      Custom Property Used for the Patching Schedule of the VM. Driven via Sovlabs Template Engine to determine the value.

      ownerNameEmail

      user@domain.com

      Built in property used in each VM payload for the owner's email address.

     

 

Create the Dynamic Property Group
  1. In vRA, create a new Property Group located in Administration>Property Dictionary>Property Group
  2. Name the group, starting with SVL_ , with a unique value
    1. In the below example we created SVL_Tagging (Be sure to include the underscore between SVL and your unique name)


 

Create the Custom Property and Template Engine Code Value inside the New Property Group
  1. Edit the new property group and create the VM tagging properties
  2. Per the VM Tagging documentation located here, the Sovlabs VM Tagging properties will start with SovLabs_CreateTags_VMW_ 
    1. Add the below properties as New Properties

      Property

      Value Encrypted Show in Request

      SovLabs_CreateTags_VMW_PatchSchedule

      { "name": "", "category": "Test_Patch_Schedule", "tagDescription": "Patch Schedule of Server", "categoryDescription": "Test from 75 Lab" } No No

      SovLabs_CreateTags_VMW_Location

      { "name": "", "category": "Test_Location", "tagDescription": "Location of Server", "categoryDescription": "Test from 75 Lab" }

      No No
      SovLabs_CreateTags_VMW_Owner

      { "name": "", "category": "Test_Owner_Information", "tagDescription": "Owner Email", "categoryDescription": "Test from 75 Lab" }

      No No

      SovLabs_CreateTags_VMW_Usage

      { "name": "", "category": "Test_Usage", "tagDescription": "Usage of Server", "categoryDescription": "Test from 75 Lab" }

      No

      No

       

       

    2. Property Breakdown

      Property Name: SovLabs_CreateTags_VMW_PatchSchedule Name value breakdown

      Property Value:

      Single Object format

      {
      "name": "",
      "category": "Test_Patch_Schedule",
      "tagDescription": "Patch Schedule of Server",
      "categoryDescription": "Test from 75 Lab"
      }

      Utilizes Template Engine via %if statement% and sets the name based on the property value of tagUsage. If the tagUsage property equals Production then the tag name will be set as Priority, or if the property is set to Test then the tag name will be set as Standard

       

      Property Name: SovLabs_CreateTags_VMW_Location Name value breakdown

      Property Value:

      Single Object format

      {
      "name": "",
      "category": "Test_Location",
      "tagDescription": "Location of Server",
      "categoryDescription": "Test from 75 Lab"
      }

      Sets the name based on the property value of tagLocation. This tag could be set directly on the blueprint or elsewhere within the vRA environment

       

      Property Name: SovLabs_CreateTags_VMW_Owner Name value breakdown

      Property Value:

      Single Object format

      {
      "name": "",
      "category": "Test_Owner_Information",
      "tagDescription": "Owner Email",
      "categoryDescription": "Test from 75 Lab"
      }

      Sets the name based on the property value of ownerNameEmail. This tag could be different for each build based on the owner, and is set automatically in each vRA request.

       

      Property Name: SovLabs_CreateTags_VMW_PatchSchedule Name value breakdown

      Property Value:

      Single Object format

      {
      "name": "",
      "category": "Test_Usage",
      "tagDescription": "Usage of Server",
      "categoryDescription": "Test from 75 Lab"
      }

      Evaluates the name based on the property value of tagUsage. This value can be set directly on the blueprint or elsewhere in the vRA environment. But could also be set as a drop down select to be shown in the request.

       

Apply the Custom Properties in the environment

The newly created properties (tagUsage & tagLocation) will need to be set in the vRA environment.

  1. In vRA, navigate to Infrastructure>Compute Resources
  2. Edit the target Compute Resources
  3. Assign the tagLocation as a static value on the Compute Resource
  4. In vRA, navigate to Design>Blueprints... select the target blueprint
  5. Click the component and select Properties>Custom Properties
  6. Assign the tagUsage property to the blueprint and ensure the selection for Show in request is enabled
    1. This assumes you have set this custom property as a drop down with multiple values to choose from
Apply the SVL Property Group as a Custom Property
Apply to any layer using a property definition
  1. The SVL property group MUST be applied as a Custom Property with the value being the same name. This can be assigned on any layer, such as blueprints, reservations, business groups, and endpoints. In this example, we will add it to the blueprint property layer
  2. In vRA, navigate to Design>Blueprints... select the target blueprint
  3. Click the blueprint property gear icon toward the top
  4. Insert a new property that is named the same as the SVL Property Group
  5. Insert the value of the new property to match the name

By adding it to a Blueprint property layer, it will ensure that this property will be triggered for all components that are contained within the blueprint

 

Additional information

n/a

The first step in providing reliable self-service automation for your CMP is starting a free trial.

Free Trial
Wave One Wave One
Wave Two Wave Two