slideshow 1 slideshow 2 slideshow 3 slideshow 4 slideshow 5 slideshow 6 slideshow 7

Creating your first vRealize Orchestrator Workflow

This article is based on using the HTML-based user interface that was introduced with vRealize Orchestrator version 7.5 and which is the only available client in version 8. If you are running an older version and would like to use the instructions for the older Java-based client then you can find those instruction here

Instructions to install vRealize Orchestrator version 8 can be found in the on-line documentation. vRealize Orchestrator is a standard component in a vRealize Automation version 8 appliance so if you already have vRA installed then you don't have to install vRealize Orchestrator separately.

The instructions on this page start after you have logged in to your vRealize Orchestrator web based user interface.

Create a connection between vRealize Orchestator and vCenter Server

A new installation of vRealize Orchestrator will not be connected automatically to your vCenter Server. To verify if your vRealize Orchestartor server can access the vCenter inventory select Inventory from the menu on the left. If you can browse through your inventory then the connection has been made. If not follow the instructions below to make the connection.

vRealize Orchestrator Workflow

If the connection to your vCenter Server was not made yet follow these instructions first. Otherwise you can start creating your first workflow.

From the menu on the left select Workflows and search for Add a vCenter. This will find the workflow with the full name of Add a vCenter Server instance. Run that workflow.

vRealize Orchestrator Workflow

Specify the address information for your vCenter Server. For your convenience, especially when using self-signed certificates enable the checkbox for ignoring certificate warnings. 

vRealize Orchestrator Workflow

Switch to the Set the connection properties tab and disable the checkbox which will allow to use one account (for example administrator@vsphere.local) for all vRealize Orchestrator workflow executions.

vRealize Orchestrator Workflow

Click Run (not in the screenshot) to add the vCenter server connection. Verify as described at the beginning of this article if you can browse though the vCenter inventory.

Create a vRealize Orchestrator workflow

 From the panel on the left select Workflows and click New Workflow.

vRealize Orchestrator 8 create a workflow

For the name I have in this example used My Workflow. When creating workflows in production it is important to select a meaningful name.

vRealize Orchestrator 8 create a workflow

To build the workflow on the graphical design canvas click the Schema tab. Next drag a Workflow element from the panel on the left to the design canvas in between the start and end icon. Notice that the blue arrow in between the start and end element will highlight in bold when dropping the element. This indicates that you can drop the element in that place.

vRealize Orchestrator 8 create a workflow

On the right side in the Workflow element details pane enter a name for this element: Stop the VM.

vRealize Orchestrator 8 create a workflow

When necessary scroll down and enter the name of the workflow you want to add in the Workflow field. If you start typing shut down guest you will see the needed workflow in the popup list. Select the workflow named Shut down guest OS and wait from the list.

vRealize Orchestrator 8 create a workflow

A blue-colored message bar shows up at the top of the middle panel that allows you to automatically promote the necessary parameters for this workflow element. For the purpose of these instructions I will not use that feature so close the message bar.

vRealize Orchestrator 8 create a workflow

In the panel at the right with the workflow element details scroll down to the Inputs section. You can see that the workflow element requires an input variable named vm of the type VC:VirtualMachine. This is a reference to the virtual machine object in your vCenter inventory. Click the Select variable field and select Create New.

vRealize Orchestrator 8 create a workflow

Create a new Input Parameter. The suggested name of vm makes sense because this will match what is needed for the workflow element. When creating larger, more complex workflows with multiple virtual machine inputs a different naming convention might be necessary.

vRealize Orchestrator 8 create a workflow

Add another Worklfow element to the canvas. Drop it on the blue arrow between the previously added element and the end element.

vRealize Orchestrator 8 create a workflow

Modify the name of the element into Change RAM. In the Workflow search field enter Change RAM. This will find the workflow in your inventory that is available by default and changes the memory of a virtual machine to a new value.  

vRealize Orchestrator 8 create a workflow

Because there already is a vm input parameter in your workflow this new element automatically uses that as the necessary input (for which vm doe you want to change the memory). Click the Select variable field and select Create New.

vRealize Orchestrator 8 create a workflow

Add a new input parameter named memory. Change the default type of string to number.

vRealize Orchestrator 8 create a workflow

Add a third Workflow element to the design canvas between the Change RAM element and the end element.

vRealize Orchestrator 8 create a workflow

Name the new Workflow element Start the VM. In the Worlflow search field enter Start virtua. While typing the workflow list will show the needed workflow named Start virtual machine and wait

vRealize Orchestrator 8 create a workflow

For this element the vm input parameter is also automatically mapped to the input parameter of your workflow. The host parameter is optional, when not using this parameter the vm will start on the host where it is already registered.

vRealize Orchestrator 8 create a workflow

Save the workflow. You have now created a simple workflow that does a shutdown, configures a new amount of RAM and starts the VM again. Run the workflow to test it's functionality.

Change the workflow to use some Javascript

When everything is working as expected then it's time to modify the workflow to change the functionality and to add some Javascript code to the workflow. The modified workflow will not configure the new amount of memory for the virtual machine but will add a specified amount of RAM to the existing memory-count for the virtual machine.

vRealize Orchestrator 8 create a workflow

Open the workflow for editing. If you look at the Inputs/Outputs tab you will be able to verify that the two input parameters we have defined are there. 

vRealize Orchestrator inputs

To understand how these inputs are being used let's have a look at the following diagram:

vRealize Orchestrator inputs schema

The vm input parameter from the workflow is used as input for each of the workflow elements in your workflow. This is because each element needs it. Which vm to stop, which vm to modify and which vm to start. In this case it's the same vm but each workflow element always needs to receive it's inputs and you as the workflow developer will have to take care of that.

The memory input is only necessary to be sent to the Change RAM element because that's where we configure the new amount of RAM.

You are going to modify the workflow now to not just configure an amount of RAM but to add an amount of memory to the virtual machines current memory count.

For this we need a new workflow variable to store our RAM calculations. Let's look at the following diagram:

vRealie Orchestrator inputs and variables

What is introduced here is a variable in the workflow that we can use to store a value. What you need to know is that workflow elements can not pass values directly between each other. So Javascript element Calculate RAM (that you will add in the next step) can not directly send the results of its calculations to Change RAM. We need to store our result in a variable. And that variable will then serve as input to the Change RAM element. So what you will be doing in the next steps is to remove the memory input from the Change RAM element (not from the entire workflow) and replace it with newMemory.

Move over to the schema tab and add a Javascript element to the beginning of your workflow between the Start element and the Stop the vm element.

vRealize Orchestrator 8 create a workflow

Name the new scripting element Calculate RAM. Add two new parameters to this element. CLick the plus-sign and select vm for input and secondly memory.

vRealize Orchestrator 8 create a workflow

Next create a new output parameter for this element. Click the plus icon and select Create New.

vRealize Orchestrator 8 create a workflow

Choose to create a new variable named newMemory. Change the type to number.

vRealize Orchestrator 8 create a workflow

The inputs and outputs for the Javascript element should look like the following screen shot. This will send the vm reference to the element and the amount or RAM we want to add. The script will get the current amount of RAM form the virtual machine, add the requested amount and places that new value in a variable that can be used by the Change RAM element.

vRealize Orchestrator 8 create a workflow

Add this scripting line to the Scripting tab of the scripting element:

newMemory = vm.config.hadrware.MemoryMb + memory;

vRealize Orchestrator 8 create a workflow

Select the Change RAM element and change the input from using memory as input to using newMemory as input. 

vRealize Orchestrator 8 create a workflow

The inputs for the Change RAM element should now look like in the following screen shot.

vRealize Orchestrator 8 create a workflow

If you take a look at the Variables tab you can verify that the necessary variable that we require to store the result of Calculate RAM has been added to your workflow.

vRealize Orchestrator variables

You can now save and run the workflow. If you now select a vm and specify an amount of RAM that amount of memory will be added to the existing memory count for your virtual machine.

 

Please enter a valid email!

Please enter a valid email!

getting started tags: 
Follow us on LinkedIn