DEV Community

Cover image for Leveraging Deployment Inputs in VMware Orchestrator (VRO) for Enhanced Workflow Customization
Azeez Lukman
Azeez Lukman

Posted on

Leveraging Deployment Inputs in VMware Orchestrator (VRO) for Enhanced Workflow Customization

VMware Orchestrator (VRO) is a powerful tool that offers a wide array of functionalities for managing and orchestrating deployments. One crucial aspect of these deployments is the ability to customize them according to specific requirements. VRO allows users to declare deployment inputs, which can be subsequently employed to tailor the deployment process to meet specific needs.

In this article, we'll delve into the intricacies of obtaining deployment inputs in VRO and how to effectively utilize them to enhance the customization of your workflows. We'll explore a scenario where these inputs are invaluable, such as allowing users to specify security groups or instance profiles during the deployment process. We will also discuss the role of a VMware vRealize Automation (vRA) endpoint in accessing deployment events, which serve as a repository for these essential inputs.

Understanding Deployment Inputs in VRO

Before we dive into the technical details, let's first grasp the concept of deployment inputs in VRO. Deployment inputs are essentially parameters or variables that allow users to influence the behaviour of their deployments. These inputs can range from simple values, like specifying the number of instances, to more complex configurations, such as security group associations or instance profile assignments. They provide a way to fine-tune deployments without the need for manual intervention at every step.

Imagine a scenario where you are orchestrating the deployment of virtual machines within a cloud environment. You might want to allow users to define the security groups and instance profiles that should be associated with these virtual machines. This is where deployment inputs come into play. Users can provide these inputs via an input form or an API call, allowing for a high degree of customization.

Accessing Deployment Events via vRA Endpoint

To effectively harness deployment inputs, VRO relies on a connection to VMware's vRealize Automation (vRA). vRA serves as a comprehensive cloud automation platform that can be integrated with VRO to extend its capabilities. It's through this integration that VRO gains access to deployment events, which are pivotal for obtaining the deployment inputs.

Deployment events are essentially records or logs of what transpires during a deployment process. They contain a wealth of information, including the deployment inputs provided by users. These events are invaluable for troubleshooting, auditing, and most importantly, for customizing workflows.

To access these deployment events, you need to make a request to the endpoint below:

/deployment/api/deployments/" + deploymentId + "/events"
Enter fullscreen mode Exit fullscreen mode

Remember to replace deploymentId with the id of your deployment. This endpoint can query and retrieve deployment events, making the deployment inputs available for further processing.

Creating a Custom Action to Manipulate Deployment Inputs

Let's move to the practical implementation of obtaining and utilizing deployment inputs. The first step is to create a custom action within VRO. This action will be designed to interact with the vRA endpoint and retrieve the deployment inputs associated with a specific deployment.

Create New Action

Create an action by navigating to Orchestrator and on the actions page you can find a button to create a new action at the top of the page, use the screenshots below for reference:

Navigate to VRO orchestrator

Create new action

Create new action

You can name it “getDeploymentInputs” and select a module to store it.

Declare Inputs

Now, it’s time to build out the action. This action should take the deployment ID as input. With the deployment ID, it can query the vRA endpoint to fetch the corresponding deployment events.

Find Inputs and create a new one, specify deploymentId as the name, as for the type, the returned events are typically represented as an array of events, which includes the deployment inputs, this can be represented as Properties, enter Properties for the type.

Write Custom Script

Declare a path as the endpoint specified earlier, and the action should be GET:

var action = "GET";
var path = "/deployment/api/deployments/" + deploymentId + "/events";
Enter fullscreen mode Exit fullscreen mode

Then, add the script below:

deploymentEventsResponse = System.getModule("com.vra.rest").vraRestCall(action, path, null, null);
var deploymentInputs = deploymentEventsResponse['content'][0]['inputs'];

System.log("deploymentInputs: ");
System.log(deploymentInputs);

return deploymentInputs;

Enter fullscreen mode Exit fullscreen mode

This script sends a request to retrieve the deployment events. Let's break down its components:

  1. Making the API Call: The vraRestCall method is used to make an HTTP GET request to the API path. This function is part of the "com.vra.rest" module, which must have been properly configured in your VRO environment.
  2. Processing the Response: We store the response from the API call in the deploymentEventsResponse variable. This response typically contains all the deployment events.
  3. Accessing Deployment Inputs: The script extracts the inputs array from the content of the first event in the response. This is where the deployment inputs are stored.
  4. Logging and Returning the Inputs: You can then log the retrieved deployment inputs using System.log for debugging and visibility. Finally, it returns the deployment inputs for further use in your workflow.

Save your action and you should be all good 🙂

Integrating the Custom Action into Workflows

With the custom action in place, you can seamlessly integrate it into your VRO workflows. For instance, in the scenario mentioned earlier, where users specify security groups and instance profiles, you can use the custom action within the deployment workflow. This ensures that the desired customization occurs as part of the deployment process.

The flexibility of this approach allows for a wide range of use cases. You can use deployment inputs to automate various aspects of your cloud infrastructure, from network configurations to application installations, all while providing users with the ability to tailor these deployments to their specific needs.

Conclusion

In conclusion, VRO provides a robust framework for orchestrating and automating deployments, and the ability to leverage deployment inputs adds an extra layer of customization and flexibility to this process. By establishing a connection with vRA, accessing deployment events, and creating custom actions to manipulate deployment inputs, you can tailor your workflows to meet your organization's unique requirements. This not only streamlines your cloud management but also empowers your users to actively participate in the customization of their deployments. The synergy between VRO and vRA, in combination with custom actions, enables you to unlock the full potential of cloud orchestration and automation.

My name is Azeez Lukman, and I'm passionate about simplifying complex technical processes and sharing insights into the world of software engineering and cloud automation. Find me everywhere @robogeek95 for more articles like this.

Top comments (0)