I have used vRO for quite some time, yet I have never really had a need to use Composite Types – until recently! This vRO feature is pretty cool and allows you to create arrays which can be polled by a Workflow and what is really a benefit for me is that allow you to minimise the amount of WFs needed or even the amount of input parameters into a Workflow.
I am a real advocate of using configuration files in vRO, and as anyone who attended my Glasgow VMUG session will (hopefully) remember that these are used for global settings which mean we don’t need to update individual Workflows if we point to these central configuration files. So where do Composite Types fit in here? Well recently I had a requirement around DNS information which had potential to impact manageability of Network Profiles in vRA. The requirement was around how DNS information would be added to a VM during deployment depending on things like location or operating system. Using vRA out the box IPAM meant that in order to achieve this I would have to create many profiles just to map different DNS info and then resolve complexity of splitting the IP ranges within the Profiles. An alternative way to meet this requirement along with making it easy to manage and fulfill any need to grow as more sites where added was composite types!
Lets have a look at how its done:
I was able to take advantage of an already existing AD related config file, so I added a new attribute
and gave it a name
I then clicked on “Array Of” and the click “Define composite type…”
Finally, I give it a Type Name, and select my fields and set teach type to string
Once that’s complete, I now have myself a nice list of domains and related information (note this is obviously test info at the moment)
Great, so what now? Well I need to integrate this into my workflow for a start. I already had the domain, OS and location as part of the payload from the users request via the portal so I could take this and make a script to match these and return the correct DNS information. Lets create a new workflow to test. Lets name it DNSTest
Once created, lets create a new attribute to use our composite type. Click to add the new attribute and give it a name. Then click on “string” under the type column. When the selection box pops up then ensure you click “array of” and then search the filter for the composite type you created
Now click on the 2 small arrows to link our configuration file
Now lets add our input parameters
and next we can add a new scriptable task to try and extract the information we need
Finally, lets give the WF a try and see what we get….woohoo success
So, a quick intro to composite types but I think they are pretty cool and useful if you dont want to be querying a external DB. Hopefully you will find some good use from them too.