After explaining parsing methods in my previous article, we’ll take a look to vRealize Automation deployment form and how to make it dynamic. For most of you that are using vRA 7 in is simplest configuration, the IaaS request look like this:
This is great and it works perfectly. Unfortunately, most of the time the customer will ask if we can add inputs into this, and here are the most frequent requests I receive when I implement a Cloud Platform in a new customer environment:
- « I want a drop down list that will show the different environments, from that I want the VM to be deployed in a specific cluster »
- » I want to have a list of networks on which the VM will be connected to »
- « Can I have a condition between two lists: I want to display a list of clusters related to the selected environment I chose in another list »
And all the time I answer: Everything is possible with vRealize Orchestrator! You could have something that look like this:
List of environments, locations, networks and prefixes are loaded dynamically and there are dependencies between each list to load the correct set of values.
I will demonstrate the last use case we talked earlier: Conditioning elements of two drop down lists, and display those values in a machine’s request in vRealize Automation 7.
Let’s get started…
Create the XML tree that will define values and conditions
This task is simple, and I always ask my customers to do it (following the XML format) and they are always pretty happy doing it because they have they can organize things the way they want and they understand quickly that is gonna be really simple to modify!
Let’s create that file (resource.xml):
Seeing the XML above, it’s easy to understand the we have 2 lists of cluster depending on the parent environment.
Create the parsing actions that will read the XML file and return the lists
Two actions needs to be created:
- The first action will return the list of environments
- The second action will return the list of clusters depending on the selected environment
This is a vRealize Orchestrator action that takes no input. It simply parses the XML file above, and returns a list of environment as an array of string:
This action is quite similar to the previous one except that it takes an input which is the environment, and returns the list of associated clusters:
Create the custom properties in vRealize Automation
Unfortunatly, Custom Properties are not really known by vRA users and that’s a shame because they are really useful. We will create 2 custom properties:
- Galaxy.Environment that will store the environment name
- Galaxy.Cluster that will store the cluster name
Custom properties can have a fixed values, or have no values and be displayed in a deployment form to let the user specify the desired values, it is also possible to load predefined values using vRealize Orchestrator actions.
To create a new custom property, go to Administration > Property Dictionary > Property Definitions. Click on the + sign.
- Name = name of the custom property
- Label = title of the field if the custom property is displayed in a form
- Visibility = visibility of the custom property
- Order = Position in the form if the custom property is displayed in a form
- Data type = type of data that will be store in this customer property
- Required = user must specify a value if the custom property is displayed in a form
- Display advice = how the value will be display in the form
- Values = How to load predefined values (to use vRO actions, we selected « External Values »)
- Enable custom values = Do we want the user to specify its own value instead of the predifined ones
Environment Custom Property:
Cluster Custom Property:
Here we do pretty much the same as the previous custom property except that to get the list of cluster we have to pass the environment name to the vRO action:
To pass the environment as an input of the vRO action, I simply specify the name of the environment custom property we created earlier.
Click OK to validate the creation of the second custom property and you should see those to new properties in the list:
Display the custom properties in a deployment form
This can be done at many places in vRealize Automation but the most practical is to set those custom properties at the deployment level. In order to do that, you will need to have a blueprint publish in your catalog.
Go to Design > Blueprints, select a blueprint and click Edit. Click on the gear to access to the deployment settings, go to Properties > Customer Properties.
Add the 2 properties as shown in the picture below, don’t forget to select « Show in request ».
From the Catalog tab, if you request the blueprint you modified above, you should see the two custom properties as new inputs of the deployment form. By selecting the production environment from the list of environment you will get the list of production clusters only. The list of clusters will change dynamically of you select another environment.
This all XML mechanism is really neat and most of the customers like it because they can modify the XML file by themselves and version it. No need to get into vRealize Orchestrator touching workflows or configuration elements at many places, everything is described in one file.
Displaying custom properties in a form, what for?
Galaxy.Environment and Galaxy.Cluster are two custom properties that have no meaning for vRealize Automation or vSphere. We created them to store the information of the selected environment and selected cluster in the VM, and those properties can be used later on by VRO for specific tasks. But some custom properties are specific to vSphere and allow to select the type of disk, the IP that will be set to the VM, the destination cluster, the dvPortGroup that the VM will be connected to and so on. All of these properties can be found in this official VMware documentation: vRealize Automation Custom Properties Reference
Custom properties is the most useful feature in vRA / vRO, don’t forget it…
May the custom props be with you, share this article if you liked it!