Property Toolkit - Use Property Toolkit SVL groups to dynamically create VM Tags

Overview

SovLabs Property Toolkit can be used in conjunction with VM Tagging to dynamically create new tag properties using SovLabs Template Engine for the name as well as the value.

Considerations

The SovLabs Plugin version is at 2019.8 or above and running vRealize 7.4 or above.


The target environment must be licensed for both Property Toolkit as well as VM Tagging. This method is simply an example of how to use the SovLabs Template Engine mixed with Property Toolkit SVL groups. This example can be expanded to create other properties for use with other SovLabs Modules such as IPAM Framework, Custom Naming, etc.


Procedure

Create a new SVL group dedicated for VM Tagging

  1. In vRA navigate to Administration>Property Dictionary>Property Groups
  2. Click New and create a new Property Group named SVL_VMTagging
    1. Note: This group can be named differently, but must contain SVL_ at the start of the name



Create your SovLabs Template Engine Properties

  1. Create New properties with the following names and values

    Property NameProperty Value
    {% if VirtualMachine.Disk0.StorageReservationPolicy %}SovLabs_CreateTags_VMW_Disk0Tag{% else %}Disk0PolicyBlank{% endif %}{% if VirtualMachine.Disk0.StorageReservationPolicy %}{"name": "{{VirtualMachine.Disk0.StorageReservationPolicy}}","category": "Storage Policy"}{% else %}Disk0PolicyBlank{% endif %}
    {% if VirtualMachine.Disk1.StorageReservationPolicy %}SovLabs_CreateTags_VMW_Disk1Tag{% else %}Disk1PolicyBlank{% endif %}{% if VirtualMachine.Disk1.StorageReservationPolicy %}{"name": "{{VirtualMachine.Disk1.StorageReservationPolicy}}","category": "Storage Policy"}{% else %}Disk1PolicyBlank{% endif %}
  2. Property Breakdown

    Property Name Breakdown:

    {% if VirtualMachine.Disk0.StorageReservationPolicy %}


    SovLabs_CreateTags_VMW_Disk0Tag


    {% else %}


    Disk0PolicyBlank


    {% endif %}

    Property Value Breakdown:

    {% if VirtualMachine.Disk0.StorageReservationPolicy %}


    {

    "name": "{{VirtualMachine.Disk0.StorageReservationPolicy}}",

    "category": "Storage Policy"

    }


    {% else %}


    Disk0PolicyBlank


    {% endif %}

    The above template engine logic via %if statement% will look to determine if a property by the name of VirtualMachine.Disk0.StorageReservationPolicy is present within the payload and assign the name as SovLabs_CreateTags_VMW_Disk0Tag if true, else it will create the property with the name of Disk0PolicyBlank


    Refer to the VM Tagging documentation for creating new VM Tagging Properties for explanation why this property is named as it is.

    The above template engine logic via %if statement% will look to determine if a property by the name of VirtualMachine.Disk0.StorageReservationPolicy is present within the payload and assign the value required to create a new SovLabs vCenter Tag Property if true, else it will create the property value with the name of Disk0PolicyBlank.


    The VM Tagging property name will be what the name of the actual VirtualMachine.Disk0.StorageReservationPolicy is itself. This value could be changed to a static value or be replaced with a different payload property

  3. This example is creating only potentially two (2) VM tags based on other properties, but this same logic could be used to create multiple different variations of VM tags by replacing the property that is being evaluated in the IF STATEMENT of the Template Engine logic

Assign the SVL_ property group to the build

  1. To utilize the tagging feature, you must assign the SVL group somewhere within the build
  2. Example: Assign to the blueprint property layer



Additional information

For more information on Property Toolkit and VM Tagging please see http://docs.sovlabs.com

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.