VMware vRealize Automation – vRA7 – Custom Hostnaming Extension for vRA7 and beyond

Overview

One of the most frequent asks when using vRA is, “How do I deploy machines using my company’s hostnaming standards automatically using vRA?”  Since the out-of-the box hostnaming only provides a way to do prefix-suffix, the answer to this question usually is that it will require customization.

This solution is intended to provide a way to implement this functionality by using a small, highly versatile custom extension which can handle 95% of use cases without writing custom code.

The rest of this article contains instructions on installing and configuring the vRA Custom Hostnaming Extension.  This extension allows administrators to model very specific custom hostnaming schemes for their vRA virtual machines, Deployments, and vCloud Director vApps using vRA custom properties, with dynamic creation of stock machine prefixes and index tracking for each unique hostname combination.

This extension is proof-of-concept or demo grade.  While it runs well and consistently, it has not been put through a formal quality assurance process, so please use with caution.

See article on SovLabs Hostname Module

Changelog

v4.0

  • Upgraded for vRA 7.0 (no longer supports vRA 6.x)
  • Property names simplified

v3.1-



For support for vRA 6.x and below, go to:

http://dailyhypervisor.com/vcloud-automation-center-vcac-5-2-custom-hostnaming-extension/

 

Download

vRA Custom Hostnaming Extension

Installation

These installation instructions assume the following:

  • You have a working vRealize Orchestrator in your environment.
  • You have a working knowledge of administering vRO.
  • The vRealize Automation plugin for vRO has been installed, and both a vRA catalog and IaaS host has been added.
  • You have the vRealize Orchestrator instance configured as an endpoint in vRealize Orchestrator in the Infrastructure configuration.
  • vRA 7+ is preconfigured with at least one working Blueprint with at least one machine component.

Follow the steps below to perform the installation:

  1. Download com.dailyhypervisor.vra.customhostname.package from the link above and copy it onto the local file system where you will run the vRealize Orchestrator client.
  2. Import com.dailyhypervisor.vra.customhostname.package into your vRO instance.
  3. Run the workflow Daily Hypervisor > vRealize Automation > Custom Hostname > Install custom hostname extension.
  4. Choose the vRA catalog and IaaS host where you’d like to install the extension and click Submit.



Configuration

To configure vRA to use the custom hostnaming extension, perform the following steps:

image

  1. Go to Administration > Property Dictionary > Property Groups.
  2. Find the Custom Hostname Properties Template, with its name preceded by a date stamp.
  3. Click Copy to create your own Property Group containing the correct properties for custom hostnaming.
    image
  4. On the Create Property Group page, change the name to reflect this configuration.
  5. [Optional] Change the description to reflect this configuration.
  6. You will now have all of the custom hostnaming extension properties in your Property Group.  Edit the properties list to reflect your desired configuration using the property explanations and/or example below.
    Extensibility.Lifecycle.Properties.VMPSMasterWorkflow32.Requested
    This property is defined in order to tell vRA’s Event Broker which of the machine’s custom properties to send to the custom hostnaming workflow.  The default value of “*” tells EB to send all of the machine’s properties.  This is required. DO NOT CHANGE OR REMOVE THIS PROPERTY.Custom.SetCustomHostname.Execute
    The existence of this property triggers the custom hostnaming workflow to run.  This must be specified to leverage the extension’s functionality.
    Note:  The value is set to “true” by default.  DO NOT CHANGE THIS.  It requires an exact match, including case, in order to trigger the workflow.Custom.ComponentMachine.HostnameScheme
    This property’s value represents the hostnaming scheme you are using for a component or single machine.  The format of this scheme looks something like this:  {part1}{part2}{##}.  The parts enclosed in curly brackets represent the names of a custom properties whose values you’d like to plug in to those slots.  The {##} indicates that you would like a two digit auto-incrementing index placed in that slot.  Anything not in curly brackets is placed in the hostname as-is.Custom.Deployment.HostnameScheme [not working yet]*
    This property is identical to the one above, except that this scheme gets applied to a Deployment or vCloud Director vApp instead of a component or single machine.Custom.ComponentMachine.NoIndexOnFirst
    Adding this property and setting the value to “true” causes the workflow not to add the index to the hostname on the first instance of each unique name.Custom.Deployment.NoIndexOnFirst [not working yet]*
    This property is identical to the one above, except that it applies to a Deployment or vCloud Director vApp instead of a component or single machine.Custom.Hostname.OwnerShortNameIdentifier
    If this property is specified, it indicates to the custom hostnaming workflow that this value is the identifier of the part of the hostname scheme where the short username (no domain and backslash) of the owner should be placed.  For instance, if you specified this property with a value of USR, any part of the hostname scheme where {USR} is specified will be replaced with the owner’s short username.
  7. Click OK to save the Property Group.
  8. Set the properties you will use as parts to the hostname scheme in the appropriate locations.
  9. Add the Property Group you configured to the appropriate location.

Examples

Let’s configure an example custom hostname scheme to get a working understanding of the functionality.  We will build a single machine hostname scheme.

    1. The first step is to create a Property Group for the configuration.
    2. Since we are configuring for a single machine, delete the Custom.Deployment.HostnameScheme and Custom.Deployment.NoIndexOnFirst properties altogether.
    3. Also, let’s exclude the owner short username and index removal functionality for this example, so delete Custom.Hostname.OwnerShortNameIdentifier and Custom.ComponentMachine.NoIndexOnFirst.
    4. Edit the Custom.ComponentMachine.HostnameScheme property value to model the following use case:
      • This scheme has four parts:  a location identifier, a group identifier, an application identifier, and an auto-incrementing index, respectively.
      • Use LOC for location, GRP for group, and APP for application.




      Your hostname scheme should look like this:  {LOC}{GRP}{APP}{###}.  You will end up with a new Property Group as shown below.

      image

    5. Now we need to configure the custom properties for each variable identifier in the scheme.  Location ties most closely to the Endpoint, Compute Resource, or Reservation, so let’s take advantage of the custom property hierarchy and specify it on the Endpoint.imageI set LOC (our location identifier) to ACY to represent Atlantic City.
    6. Group will be specified at the Business Group level, so in my Development Business Group, I created a property named GRP with the value DEV.image
    7. The APP identifier’s value will be unique to the machine.  So I went to my CentOS 6.6 x64 Blueprint, selected my vSphere Machine on the Design Canvas, and created a property named APP, with a value of LNX for Linux.image
    8. Also, be sure to select the Property Group we created in order to tie the hostname scheme properties to machine builds from this Blueprint.  Of course, you can specify this anywhere in the property hierarchy that supports Property Groups.imageBy putting three # symbols in for the index, we are indicating that it will be three digits. Since it will be the first time using this hostname combination, the extension should dynamically create a new Machine Prefix, and the index should start at 001 and increment from there.
    9. So, if I request a CentOS Linux 6.6 x64 on the vCenter Endpoint in Atlantic City as a member of the Development group, my end result should be…

      ACYDEVLNX001

      A test reveals that the custom hostnaming extension does its job.

      image

 

Custom Deployment and vCloud Director vApp Naming [not working]*

Custom Deployment and vApp naming works in an almost identical way.  However, there are two differences to note.

      1. It uses a different hostname scheme property.  Instead of Custom.ComponentMachine.HostnameScheme as in our previous example, the workflow looks for Custom.Deployment.HostnameScheme.  The reason for this is to allow component machines to have different naming schemes than their parent.  Component machines inherit properties from the parent Deployment or vApp, and when the same property is specified on both levels, the parent property overrides that of the component machine.  Therefore, without separate properties, component machines would be forced to implement the same hostnaming scheme as the parent Deployment or vApp.
      2. Deployments do not inherit all of the same properties as component machines.  Namely, they do not inherit properties from placement entities, such as Endpoints, Compute Resources, and Reservations.  This is because Deployments themselves do not reside anywhere or consume resources.  They are simply a logical grouping of actual machines.  The component machines are the ones that are actually placed on infrastructure, and it’s possible to configure a Deployment with component machines that can or will end up on different resources, even in different locations.  So it becomes impossible to logically tie Deployments to singular infrastructure. vApps, on the other hand, do support locations, as vCloud Director and vRA both consider them as located in the organization vDC, along with their component virtual machines.  In other words, if you were to use the value of Custom.ComponentMachine.HostnameScheme in our previous example as the value of Custom.Deployment.HostnameScheme in a Deployment, you would get an error, because it will not find a property named LOC.

Adding the Owner’s Short Username to a Custom Hostnaming Scheme

One additional function you can use that we did not explore in our example is adding an owner’s short username (without the domain and backslash) as a part of the hostname.

To do this, you can simply specify one additional property, Custom.Hostname.OwnerShortNameIdentifier.  Set the value of this property to the identifier you will use in your hostname scheme to specify where to place the username.

Here’s an example of a Property Group created for this scenario:

image

If I logged in as vcacsvc@dailyhypervisor.remote and requested a machine from a Blueprint with this scheme enabled, I could expect the machine to be named like this:

image

 

 

* Not currently working due to product regression and/or lack of documentation


17 Replies to “VMware vRealize Automation – vRA7 – Custom Hostnaming Extension for vRA7 and beyond”

  1. Wanted to install your Workflow but always getting mistakes:

    [2016-04-18 10:04:06.218] [I] {“type”:”and”,”subClauses”:[{“type”:”expression”,”operator”:{“type”:”equals”},”leftOperand”:{“type”:”path”,”path”:”data~lifecycleState~state”},”rightOperand”:{“type”:”constant”,”value”:{“type”:”string”,”value”:”VMPSMasterWorkflow32.Requested”}}},{“type”:”expression”,”operator”:{“type”:”equals”},”leftOperand”:{“type”:”path”,”path”:”data~lifecycleState~phase”},”rightOperand”:{“type”:”constant”,”value”:{“type”:”string”,”value”:”POST”}}},{“type”:”expression”,”operator”:{“type”:”equals”},”leftOperand”:{“type”:”path”,”path”:”data~machine~properties~Custom.SetCustomHostname.Execute”},”rightOperand”:{“type”:”constant”,”value”:{“type”:”string”,”value”:”true”}}}]}
    [2016-04-18 10:04:07.137] [E] Error in (Workflow:Install state change workflow extension / Prepare params (item1)#67) 403 Forbidden
    [2016-04-18 10:04:07.190] [E] Workfow execution stack:
    ***
    item: ‘Install state change workflow extension/item1’, state: ‘failed’, business state: ‘null’, exception: ‘403 Forbidden (Workflow:Install state change workflow extension / Prepare params (item1)#67)’
    workflow: ‘Install custom hostname extension’ (d86f3b49-db74-45d0-9c08-9bf6d2e8e3c9)
    | ‘attribute’: name=workflowDescription type=string value=Runs a vRO workflow for custom hostnaming
    | ‘attribute’: name=vCACMachineState type=string value=Requested
    | ‘attribute’: name=vCACWorkflowPriority type=number value=1.0
    | ‘attribute’: name=vCACWorkflowTiming type=string value=Post
    | ‘attribute’: name=vCACWorkflowTriggerProperty type=string value=Custom.SetCustomHostname.Execute
    | ‘attribute’: name=propertySetDetails type=Array/CompositeType(name:string,defaultValue:string,encrypted:boolean,promptUser:boolean):PropertyDetails value=#{#CompositeType(name:string,defaultValue:string,encrypted:boolean,promptUser:boolean):PropertyDetails##[#promptUser#=#boolean#false#+#encrypted#=#boolean#false#+#defaultValue#=#string#true#+#name#=#string#Custom.SetCustomHostname.Execute#]##;#CompositeType(name:string,defaultValue:string,encrypted:boolean,promptUser:boolean):PropertyDetails##[#promptUser#=#boolean#false#+#encrypted#=#boolean#false#+#defaultValue#=#string##+#name#=#string#Custom.Deployment.HostnameScheme#]##;#CompositeType(name:string,defaultValue:string,encrypted:boolean,promptUser:boolean):PropertyDetails##[#promptUser#=#boolean#false#+#encrypted#=#boolean#false#+#defaultValue#=#string##+#name#=#string#Custom.ComponentMachine.HostnameScheme#]##;#CompositeType(name:string,defaultValue:string,encrypted:boolean,promptUser:boolean):PropertyDetails##[#promptUser#=#boolean#false#+#encrypted#=#boolean#false#+#defaultValue#=#string#USR#+#name#=#string#Custom.Hostname.OwnerShortNameIdentifier#]##;#CompositeType(name:string,defaultValue:string,encrypted:boolean,promptUser:boolean):PropertyDetails##[#promptUser#=#boolean#false#+#encrypted#=#boolean#false#+#defaultValue#=#string#true#+#name#=#string#Custom.Deployment.NoIndexOnFirst#]##;#CompositeType(name:string,defaultValue:string,encrypted:boolean,promptUser:boolean):PropertyDetails##[#promptUser#=#boolean#false#+#encrypted#=#boolean#false#+#defaultValue#=#string#true#+#name#=#string#Custom.ComponentMachine.NoIndexOnFirst#]##}#
    | ‘attribute’: name=propertySetName type=string value=Custom Hostname Properties Template
    | ‘attribute’: name=propertySetDescription type=string value=Properties for Custom Hostnaming Extension v4
    | ‘attribute’: name=setCustomHostnameWorkflow type=Workflow value=dunes://service.dunes.ch/Workflow?id=’5febfe67-9247-4f72-a072-59c1ce5c2ec1’&dunesName=’Workflow’
    | ‘attribute’: name=environmentConfigElement type=ConfigurationElement value=dunes://service.dunes.ch/ConfigurationElement?id=’86e55a3e-73f6-428b-b21f-a69ac280281c’&dunesName=’ConfigurationElement’
    | ‘attribute’: name=vCACHostAttributeName type=string value=vraIaasHost
    | ‘attribute’: name=vcoWorkflowAsync type=boolean value=false
    | ‘attribute’: name=workflowTimeout type=number value=60.0
    | ‘attribute’: name=workflowSubscriptionVersion type=string value=0.0.1
    | ‘attribute’: name=vcacCafeHostAttributeName type=string value=vraHost
    | ‘input’: name=vraCatalogHost type=vCACCAFE:VCACHost value=dunes://service.dunes.ch/CustomSDKObject?id=’1553d476-520d-4cb9-9f6b-86022db0ec96’&dunesName=’vCACCAFE:VCACHost’
    | ‘input’: name=vraIaasHost type=vCAC:VCACHost value=dunes://service.dunes.ch/CustomSDKObject?id=’181f6d42-304c-4b2e-9cb2-fe7c3af287ba’&dunesName=’vCAC:VCACHost’
    | ‘no outputs’
    –workflow: ‘Install state change workflow extension’ (7d047254-e1a4-46d4-8071-57c3dda3fec5)
    | ‘attribute’: name=vroWorkflowName type=string value=
    | ‘attribute’: name=blocking type=boolean value=true
    | ‘attribute’: name=status type=string value=
    | ‘attribute’: name=workflowCriteria type=string value=
    | ‘attribute’: name=eventTopic type=vCACCAFE:EventTopic value=__NULL__
    | ‘attribute’: name=propertySetDetailsWithEbProperty type=Array/CompositeType(name:string,defaultValue:string,encrypted:boolean,promptUser:boolean):PropertyDetails value=__NULL__
    | ‘attribute’: name=propertyGroupNameWithTimestamp type=string value=
    | ‘input’: name=vCOWorkflow type=Workflow value=dunes://service.dunes.ch/Workflow?id=’5febfe67-9247-4f72-a072-59c1ce5c2ec1’&dunesName=’Workflow’
    | ‘input’: name=workflowDescription type=string value=Runs a vRO workflow for custom hostnaming
    | ‘input’: name=vCACMachineState type=string value=Requested
    | ‘input’: name=vCACWorkflowPriority type=number value=1.0
    | ‘input’: name=vCACWorkflowTiming type=string value=Post
    | ‘input’: name=vCACWorkflowTriggerProperty type=string value=Custom.SetCustomHostname.Execute
    | ‘input’: name=propertySetDetails type=Array/CompositeType(name:string,defaultValue:string,encrypted:boolean,promptUser:boolean):PropertyDetails value=#{#CompositeType(name:string,defaultValue:string,encrypted:boolean,promptUser:boolean):PropertyDetails##[#promptUser#=#boolean#false#+#encrypted#=#boolean#false#+#defaultValue#=#string#true#+#name#=#string#Custom.SetCustomHostname.Execute#]##;#CompositeType(name:string,defaultValue:string,encrypted:boolean,promptUser:boolean):PropertyDetails##[#promptUser#=#boolean#false#+#encrypted#=#boolean#false#+#defaultValue#=#string##+#name#=#string#Custom.Deployment.HostnameScheme#]##;#CompositeType(name:string,defaultValue:string,encrypted:boolean,promptUser:boolean):PropertyDetails##[#promptUser#=#boolean#false#+#encrypted#=#boolean#false#+#defaultValue#=#string##+#name#=#string#Custom.ComponentMachine.HostnameScheme#]##;#CompositeType(name:string,defaultValue:string,encrypted:boolean,promptUser:boolean):PropertyDetails##[#promptUser#=#boolean#false#+#encrypted#=#boolean#false#+#defaultValue#=#string#USR#+#name#=#string#Custom.Hostname.OwnerShortNameIdentifier#]##;#CompositeType(name:string,defaultValue:string,encrypted:boolean,promptUser:boolean):PropertyDetails##[#promptUser#=#boolean#false#+#encrypted#=#boolean#false#+#defaultValue#=#string#true#+#name#=#string#Custom.Deployment.NoIndexOnFirst#]##;#CompositeType(name:string,defaultValue:string,encrypted:boolean,promptUser:boolean):PropertyDetails##[#promptUser#=#boolean#false#+#encrypted#=#boolean#false#+#defaultValue#=#string#true#+#name#=#string#Custom.ComponentMachine.NoIndexOnFirst#]##}#
    | ‘input’: name=propertySetName type=string value=Custom Hostname Properties Template
    | ‘input’: name=propertySetDescription type=string value=Properties for Custom Hostnaming Extension v4
    | ‘input’: name=vcoWorkflowAsync type=boolean value=false
    | ‘input’: name=workflowTimeout type=number value=60.0
    | ‘input’: name=vraCatalogHost type=vCACCAFE:VCACHost value=dunes://service.dunes.ch/CustomSDKObject?id=’1553d476-520d-4cb9-9f6b-86022db0ec96’&dunesName=’vCACCAFE:VCACHost’
    | ‘input’: name=workflowSubscriptionVersion type=string value=0.0.1
    | ‘no outputs’
    *** End of execution stack.

    Do you know what I’m doing wrong?!

    By the way is it possible to install your AD Computer Management Workflows in vRealize 7??

    Greetz
    Susie

    1. Hi Susie, We’ve used the Custom Host Naming module from SovLabs that they support as new vRA versions are released. They also have modules in their vRO plug-in framework for AD security groups and OUs, Infoblox, Bluecat, Puppet, Chef, ServiceNow, Netscaler, F5, and Cisco ASA. More at http://www.sovlabs.com

  2. Thanks Tom. We’ve used the Custom Host Naming module from SovLabs that they support as new vRA versions are released. They also have modules in their vRO plug-in framework for Infoblox, Bluecat, Puppet, Chef, ServiceNow, AD security groups and OUs, Netscaler, F5, and Cisco ASA. More at http://www.sovlabs.com

  3. Hello, First I tried the “Install custom hostname extension” WF but same error above. Below is “Create Property Group” WF log. Is there any fixed version or are we missing something while running the WFs. Thanks

    2016-05-08 02:51:41.741+0300 : ERROR : Error in (Workflow:Create property group / Create Property Group (item14)#54) Data serialization error.
    2016-05-08 02:51:41.792+0300 : ERROR : Workfow execution stack:
    ***
    item: ‘Create property group/item14’, state: ‘failed’, business state: ‘null’, exception: ‘Data serialization error. (Workflow:Create property group / Create Property Group (item14)#54)’
    workflow: ‘Create property group’ (0b8de383-dbc4-4af8-8259-33c1671cd995)
    | ‘input’: name=propertyGroupDetails type=Array/CompositeType(name:string,defaultValue:string,encrypted:boolean,promptUser:boolean):PropertyDetails value=null
    | ‘input’: name=propertyGroupName type=string value=
    | ‘input’: name=propertyGroupDescription type=string value=
    | ‘input’: name=vraCatalogHost type=vCACCAFE:VCACHost value=dunes://service.dunes.ch/CustomSDKObject?id=’1b22c263-11f7-46e1-a248-0ff7beccf7a5’&dunesName=’vCACCAFE:VCACHost’
    | ‘no outputs’
    | ‘no attributes’
    *** End of execution stack.

    1. What workflow did you run to install the package? You should be running the “Install Custom Hostname” workflow. Not the one under the install folder. Please confirm you are running the appropriate install workflow. When you run it you will need to select the proper Catalog (vRA Appliance) and IaaS (Windows Server) hosts. Please ensure you are choosing the proper host as well.

      1. Running that same error here…
        Running correct Workflow… version 7.0.1
        [2016-05-17 17:33:38.797] [E] Error in (Workflow:Create property group / Create Property Group (item14)#54) 403 Forbidden
        [2016-05-17 17:33:38.826] [E] Workfow execution stack:
        ***
        item: ‘Create property group/item14’, state: ‘failed’, business state: ‘null’, exception: ‘403 Forbidden (Workflow:Create property group / Create Property Group (item14)#54)’
        workflow: ‘Install custom hostname’ (

        1. It looks like the account use to create the vRA endpoint for the tenant in vRO doesn’t have the necessary permissions in vRA. Check the account permission and the vRA endpoint in vRO. It should be specific to the tenant that you are working with.

  4. Found the fix to my environment…. when registering the vRA host in vRO under vRealize Automation, do not use the “Add a vRA host using component registry” instead use the “Add a vRA host” workflow. Then when you register the plugin it works fine.

  5. Trying to install the extention and get an error at this point:

    Run the workflow Daily Hypervisor > vRealize Automation > Custom Hostname > Install custom hostname extension.

    vRO pops up and says “Validation process report 4 errors in the workflow. Disable validation checking in the preferences or correct the errors”.

    I’m not sure what its angry about.

  6. Installed the modules and everything works great except the numbering scheme. I am using three digits so {###} and it gets picked up fine, but the first machine name is always missing any numbers after the name and the second machine always goes to 002 rather than 001. Has anyone else seen this?

  7. Thanks for updating this to work with 7! I did notice a small item regarding multi-tenancy. It looks like you can only run the install for a single tenant. When I deployed this I deployed it to the default tenant which worked great, but when I ran the install workflow for a subtenant the workflow skipped creating the EBS. Once I deleted the EBS from the default tenant and then ran the install again against the subtenant it correctly created the EBS for the subtenant. I haven’t dug into it yet but I suspect it might be something to do with the switch script in the workflow. Thanks again for all of your hard work!

  8. Why vra 7 limit number of machine prefix to 30 instead of Unlimited
    When a acces to Blueprint configuration, I can see only the first 30 Machine Prefix. the 31 32 … will be removed from blueprints configured earlier.

    I hope to find the solution asap
    Many thank’s

  9. Hi,
    Did you manage to get anywhere with manipulating vRA 7 Deployment names/attributes?
    I too am unable to determine how to do (was easy in vCAC 6 using the parent object of vCAC VM entity).
    Bit of a limitation at the moment so if you have any further info on the subject would be gratefully received.
    Many thanks

Leave a Reply