Multi-location Management with vRealize

September 25, 2018

Using VMware vRealize Orchestrator Configuration Elements to Enable vRealize Automation Locations

Tweet This: 
Share on LinkedIn:

By Dana Gertsch, Kovarus Senior Consultant

A recent customer project involved working with three data centers spanning two continents (U.S. & Europe). Each continent had its own Microsoft Active Directory domain, VMware vCenter and vAPI endpoint. The goal was to deploy a Virtual Machine (VM) into one of these locations, manage Windows Machine Accounts (add and remove Computer objects), and apply tags to the deployed machine. And if that wasn’t enough, they wanted custom host naming based on deployment environment, operating system, and a need to have globally unique machine numbers.

Our solution leveraged VMware vRealize Automation (vRA) 7.4, and several vRealize Orchestrator (vRO) Workflows and Actions.

Our first order of business, after deploying and testing the base environment, was to tackle the custom host names. We had two environments, production (prod) and development (dev), two operating systems, Windows and Linux. Each operating system would be assigned a unique number range, with Linux being 5000 to 5999, and Windows being 6000 to 6999. The decision was made to leverage a global vRO Configuration Element (CE) to store the next available number for each OS.

Create new global Configuration Element

Adding a Configuration Element is fairly simple, click on the Configuration Elements tab in the vRO client, right click the root folder, then add a new folder (corp.local in this example).

Supply the folder name, then click Ok.

 

Next add an Element by right clicking on your new folder, clicking New element, and naming it configurations.

The new Element will open for editing when you click Ok.

Click the red “A+,” then click att0. Assign it the name of windowsUniqueNumber, then click Ok.

The Type is set to string by default, change it to number by click the word string, then highlighting number. Click Accept to save your changes.

Now set the beginning number to 6000 in the Value box.

Add another attribute, naming it linuxUniqueNumber, and set it number value to 5000.

Your element should look like this when done.

Click Save and Close at the bottom right hand corner to save your work.

Create host numbering workflow

Create a new vRO workflow, adding configurationElement as Type ConfigurationElement as an Attribute. Set the value to the Configuration Element you just created. Add another input as serverOS as Type string (default). Add a new scriptable item and add configurationElement and serverOS as inputs.

Add the following code into the Scripting section.

Save and run your new workflow entering either Linux or Windows when prompted.

Now check your Configuration Element to verify the number has incremented for the correct OS.

Create vRA location based workflow

The process is similar for storing data for each location. Simply create a new Configuration Element using the location name (use the same Syntax as your vRA locations). In this example locationHelloWorld was populated with a simple string value.

Next add a new workflow, with location / string as the only input parameter. Next paste the following code into Scripting of a newly added Scriptable Task element. The workflow will find the locations Configuration Element by name, then print out the value of a predefined attribute.

Finally run the new workflow. Hopefully you should see the value from the location-specific Configuration Element.

Configuration Elements are a great tool to extend the capability of vRA, and are especially useful for location based static values, and to store values that can be updated on the fly. Hopefully this brief article provided the basic framework to flesh out your project.