Overview
This overview shows how to use SovLabs Property Toolkit and the Sovlabs Template Engine to dynamically build a VM Tagging property to be assigned to a VM build.
Sovlabs VM Tagging Documentation Reference
Sovlabs VM Tagging Documentation Site
http://docs.sovlabs.com/latest/vmware-vra7x-plugin/modules/vsphere/vm-tagging/
Standard VM Tagging Setup - http://docs.sovlabs.com/latest/vmware-vra7x-plugin/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
- 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.
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
- In vRA, create a new Property Group located in Administration>Property Dictionary>Property Group
- Name the group, starting with SVL_ , with a unique value
- In the below example we created SVL_Tagging (Be sure to include the underscore between SVL and your unique name)
|
- 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
- Edit the new property group and create the VM tagging properties
- Per the VM Tagging documentation located here, the Sovlabs VM Tagging properties will start with SovLabs_CreateTags_VMW_
Add the below properties as New Properties
Property
Value Encrypted Show in Request SovLabs_CreateTags_VMW_PatchSchedule
{ "name": "{% if tagUsage == 'Production' %}Priority{% elsif tagUsage == 'Test' %}Standard{% endif %}", "category": "Test_Patch_Schedule", "tagDescription": "Patch Schedule of Server", "categoryDescription": "Test from 75 Lab" } No No SovLabs_CreateTags_VMW_Location
{ "name": "{{tagLocation}}", "category": "Test_Location", "tagDescription": "Location of Server", "categoryDescription": "Test from 75 Lab" }
No No SovLabs_CreateTags_VMW_Owner { "name": "{{ownerNameEmail}}", "category": "Test_Owner_Information", "tagDescription": "Owner Email", "categoryDescription": "Test from 75 Lab" }
No No SovLabs_CreateTags_VMW_Usage
{ "name": "{{tagUsage}}", "category": "Test_Usage", "tagDescription": "Usage of Server", "categoryDescription": "Test from 75 Lab" }
No No
Property Breakdown
Property Name: SovLabs_CreateTags_VMW_PatchSchedule Name value breakdown Property Value:
Single Object format
{
"name": "{% if tagUsage == 'Production' %}Priority{% elsif tagUsage == 'Test' %}Standard{% endif %}",
"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
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": "{{ownerNameEmail}}",
"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": "{{tagUsage}}",
"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.
- In vRA, navigate to Infrastructure>Compute Resources
- Edit the target Compute Resources
- Assign the tagLocation as a static value on the Compute Resource
- In vRA, navigate to Design>Blueprints... select the target blueprint
- Click the component and select Properties>Custom Properties
- Assign the tagUsage property to the blueprint and ensure the selection for Show in request is enabled
- This assumes you have set this custom property as a drop down with multiple values to choose from
- 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
- 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
- In vRA, navigate to Design>Blueprints... select the target blueprint
- Click the blueprint property gear icon toward the top
- Insert a new property that is named the same as the SVL Property Group
- 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
0 Comments