VMware Cloud Community
Dinger761
Contributor
Contributor

vra VM name rename in vCenter after deploy

Hi All,

I currently have a Windows template that I am deploying using vRA 7.3 using a customization specification.  This seems to work okay but does not leave the VM in a very friendly manner within vCenter, let me explain.

In our vCenter environment, we have a number of virtual machines all showing within vCenter with a machine name followed by a short description - this helps the small support team easily identify machines in question... as shown here:   aaa000m01 - Application Name machine

At the moment, the machines appear in vCenter as:  aaa000m01

The Windows OS machine name does not need to change.  When the user requests the virtual machine, we will be asking them to provide a short description, this description could be appended to the name in vCenter as shown above to provide a useful machine name and description.

Please can you offer some advice on how this should be done and the steps involved?

Thanks

Chris

0 Kudos
5 Replies
daphnissov
Immortal
Immortal

The easiest way to do this is to use the SovLabs Custom Naming module. Although this is a paid thing, it is extremely powerful because of how it uses a template-driven language. So in your case, you could create a custom property and show it on the request form. When a user requests the catalog item, the module (within vRO) takes the custom property and combines it with whatever you want to remain to form the machine name. There's no custom scripting or coding you have to do within vRO. It's all driven through XaaS forms which it publishes for you in vRA.

0 Kudos
Dinger761
Contributor
Contributor

Hi,

Thanks for the quick response but I need to find a solution that doesn't require additional cost.

I read on some web sites about the possibility of utilising custom resources but I'm not sure how to go about taking the description field as a string to add to the name of the VM, and I also don't know how to only change the VM name in vCenter (without the hostname changing in the OS).  I'm happy for this to be performed as a secondary task after the deployment, if we can kick it off straight after the deployment.

Hopefully there are other suggestions.

Thanks

Chris

0 Kudos
Gr33nEye
Enthusiast
Enthusiast

To change VM name(display) in vCentre all you need to do is just right click on it and rename. This does not change the OS name.

To do the rename of the display as part of the blueprint deploy you will need to add a custom property that is set to prompt user and that is then passed onto a vRO task.

This

https://www.definit.co.uk/2016/03/vrealize-automation-7-custom-hostname-with-event-broker-eb-subscri...

should give you a rough idea of what you would need to do. Yes it is not exact but somewhat close. The link does change the name of the VM prior to deploy(OS included) so for you case the subscription condition needs to be POST task.

0 Kudos
Gr33nEye
Enthusiast
Enthusiast

Just realized that you may want to do the re-name from withing vRO, there is a workflow for this.

pastedImage_0.png

daphnissov
Immortal
Immortal

As kind of hinted at above, you're going to have to develop a custom vRO workflow that gets the vRA payload including a custom property that gets passed, do some string truncation to extract the portion of it you want, and patch that in to the existing rename workflow to append it to the VM name. Once you have that, you'll want to set up an EBS subscription and call it on the Machine Provisioned lifecycle on the POST phase.