Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
VMware vRealize Orchestrator Cookbook. - Second Edition

You're reading from  VMware vRealize Orchestrator Cookbook. - Second Edition

Product type Book
Published in Nov 2016
Publisher Packt
ISBN-13 9781786462787
Pages 556 pages
Edition 2nd Edition
Languages
Author (1):
Daniel Langenhan Daniel Langenhan
Profile icon Daniel Langenhan

Table of Contents (19) Chapters

VMware vRealize Orchestrator Cookbook Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Installing and Configuring Orchestrator 2. Optimizing Orchestrator Configuration 3. Distributed Design 4. Programming Skills 5. Visual Programming 6. Advanced Programming 7. Interacting with Orchestrator 8. Better Workflows and Optimized Working 9. Essential Plugins 10. Built-in Plugins 11. Additional Plugins 12. Working with vSphere 13. Working with vRealize Automation

Chapter 4. Programming Skills

This chapter deals with the skills that an Orchestrator user needs on a more or less daily basis. We will be looking at the following recipes:

  • Version control

  • Changing elements in a workflow

  • Importing and exporting Orchestrator elements

  • Working with packages

  • Workflow auto documentation

  • Resuming failed workflows

  • Using the workflow debugging function

  • Undelete workflows and actions

  • Scheduling workflows

  • Sync presentation settings

  • Locking elements

Introduction


In this chapter, we will focus on using the Orchestrator Client and what one should know about it. The Orchestrator Client is a Java-based client that can be launched via the Orchestrator home page or can be locally installed. The Orchestrator Client is mainly used to create new workflows as well as to configure plugins. However, you also can use it for executing workflows. In this case, it is a good idea to configure non-administrative access to Orchestrator as shown in the User management recipe in Chapter 7, Interacting with Orchestrator.

The Orchestrator icons

The Orchestrator Client has three modes: Run, Design, and Administer. The setting can be changed by selecting the value from the top drop-down menu. You will use the Orchestrator Client mostly in the Design mode when you program. If you are a user, you probably will use the Run mode.

Let's have a quick look at all the icons of Orchestrator Client:

Version control


In this recipe, we will look at how to use the Orchestrator version control and use it to control your software development. Version control is part of almost all elements.

Getting ready

A working Orchestrator is required, and you will need the rights to create new workflows and run them. We will work with the Orchestrator Client.

We need an existing workflow that we can play around with. In this recipe, we will use the 00.00 BasicWorkflow workflow of the example package. The finished example is the 04.02 VersionControl example workflow.

How to do it...

We will use a workflow for this example; however, it works for other elements too:

  1. Make a duplicate of the 00.00 BasicWorkflow workflow.

  2. Click on General and have a look at the current version (see the following screenshot).

  3. Open the workflow for editing by right-clicking on it and selecting Edit.

  4. Drag a system log element from the log section into the schema.

  5. Bind the text in-parameter to an existing string variable.

  6. Click on General...

Changing elements in a workflow


In this recipe, we will have a closer look at the challenges that change the workflow elements in a schema pose. Changing the in- and out-parameters, as well as moving or renaming actions will be discussed. You will learn how to make these changes as well as what to avoid.

Getting ready

We need a workflow that has an additional workflow as well as an action in its schema.

You can use the 04.01.02 MainWorkFlow and 04.01.01 SubWorkflow example workflows as well as the reNameMe action, which is part of the example package.

How to do it...

There are only two major tasks: changing the parameters and renaming/moving the actions.

Changing the parameters of workflows and actions

If you change a subworkflow's in/out-parameters, you will need to synchronize its parameters by following these steps:

  1. Make sure that you have a workflow that has a workflow as an element in its schema. You can use the 04.01.02 MainWorkFlow and 04.01.01 SubWorkflow example workflows.

  2. In the subworkflow...

Importing and exporting Orchestrator elements


In this recipe, we will learn how to import and export elements from one Orchestrator to another using Orchestrator Client.

Getting ready

We need at least one workflow, action, or other element that we can export, delete, and import. If you have two Orchestrator servers, you can export the element on one and import into the other.

How to do it...

In this example, we will use a workflow to import and export an object. However, the same methods apply to all Orchestrator elements.

Exporting an object

We will use the 00.00 BasicWorkflow workflow of the example package in this example. Exporting also works for other elements:

  1. To export a workflow, right-click on it and select Export workflow.

  2. A window will pop up that shows you your local drives from the computer you are running Orchestrator Client on.

  3. Select a directory and a name for the workflow (the default name is the name of the workflow). The default file extension is .workflow.

  4. You can define a name...

Working with packages


In this recipe, you will learn how to create, export, and generally work with packages. Packages are great for shipping complete Orchestrator solutions between Orchestrators to customers or for backup.

Getting ready

We need at least one workflow or action to work with in this recipe. Optimally, you have workflows and actions that depend on each other. You can test with the 04.03 Export-Package example workflow; it contains an action and another workflow.

How to do it...

This recipe has several sections. As an overview, the following screenshot shows all the icons and their usages. To get to the correct section, follow these instructions:

  1. Using Orchestrator Client, make sure that you are in Design mode.

  2. Click on packages (the yellow box with a white circle icon):

Create a new package

  1. Either right-click on the white space below the displayed packages and select Add package, or select the icon from the right-hand side (the yellow box with a white circle icon).

  2. Select a new name...

Workflow auto documentation


This recipe will showcase the automatic documentation ability of Orchestrator. We will learn what Orchestrator documents and how it documents workflows.

Getting ready

We need at least one workflow for this recipe that we can document. A good example workflow would be one that contains other workflows, actions, and scriptable tasks.

How to do it...

  1. Right-click on a workflow or a folder and select Generate Documentation.

  2. Select a directory and give the file a name.

A PDF with the documentation is now created.

How it works...

The documentation that is created isn't that flashy, but it is quite useful. The created PDF document contains the following sections:

Icon

Used in recipe/chapter

What is covered?

My Orchestrator...

Resuming failed workflows


This recipe looks at the ability to resume a failed workflow. It allows you to resume a workflow when an error has occurred.

Getting ready

We just need a working Orchestrator, and you will need the rights to create new workflows and run them. We will work with the Orchestrator Client.

To make it easier, we reuse the workflow we will create in the Error handling in workflows recipe in Chapter 5, Visual Programming ( the 05.03.01 Error Handling example workflow). If you don't have it, please create it as described or use the example package that is supplied with this book.

How to do it...

The following steps showcase the functionality:

  1. Create a new workflow.

  2. Drag Workflow element onto the schema and select the workflow we created in the Error handling in workflows recipe in Chapter 5, Visual Programming.

  3. Assign the in-parameter of the Error Handling workflow to the in-parameter of the workflow you added in step 2.

  4. Drop two additional System log instances before and after the...

Using the workflow debugging function


This recipe showcases how to use the debug feature to find and resolve errors in a workflow. The debug function was introduced in version 5.5.

Getting ready

We just need a working Orchestrator, and you will need the rights to create new workflows and run them. We will work with the Orchestrator Client.

We need a new workflow, and to make things easier we reuse some old workflows, such as 00.00 BasicWorkflow and 05.03.01 Error Handling from the example package.

How to do it...

  1. Create a new workflow and add the 00.00 BasicWorkflow and 05.03.01 Error Handling workflows (as shown in the following screenshot).

  2. Bind all variables as required.

  3. Right-click on the first element of your workflow and select Toggle breakpoint. A blue ball appears on the left next to the element.

  4. You can debug a workflow either while still in edit mode or when you exit it. Choose one and click on Debug (the bug icon) to start the debug process.

  5. The debug process starts the workflow and will...

Undelete workflows and actions


This recipe shows how to undelete deleted workflows and actions, as this comes in handy when one deletes something that one shouldn't have.

Getting ready

To undelete a workflow, we need a deleted workflow or action first.

How to do it...

We will use a workflow in this example, as the undelete function for actions works exactly the same:

  1. Right-click on a folder (or the root element ) and select Restore deleted workflows.
  2. A popup will display all the workflows or actions that can be restored. Tick all the workflows you would like to restore and click on Restore:

The workflows or actions will now be restored.

How it works...

All workflows and actions are stored in the Orchestrator database and as such, they can be restored. However, you cannot restore a workflow with the same ID that already exists; names of workflows are of no importance in Orchestrator.

Scheduling workflows


In this recipe, you will learn how to schedule workflows. Scheduled workflows will automatically run at given times and intervals.

Getting ready

We need at least one workflow we can schedule. The workflow should not contain a user interaction.

How to do it...

  1. Right-click on the workflow you would like to schedule and choose Schedule workflow.

  2. Select Task name. By default, the task name is set to be the workflow name. A good naming standard comes in handy here, especially if you schedule recurring tasks.

  3. Set a start date and time.

  4. If this task has been scheduled in the past, you can still run the workflow. This setting is useful if a task had been scheduled but during the planned execution time, Orchestrator server was not available (for example, powered off). The task will then start as soon as Orchestrator server is available again.

  5. You can create a recurring task. You have the base setting for every minute, hour, day, week, and month. Except for the week setting, you can schedule...

Sync presentation settings


In this recipe, we will make it easier for you to reuse presentation settings from embedded workflows.

Getting ready

We need a workflow with a presentation assigned to it; you can use the 05.05 Workflow Presentation example workflow.

How to do it...

  1. Log into the Orchestrator Client and create a new workflow.

  2. Drag the workflow with the presentation onto the schema. You can use the 05.05 Workflow Presentation example workflow.

  3. Right-click the workflow and select Synchronize | Synchronize presentation.

  4. Confirm that you want to sync.

  5. Check the presentation of your new workflow.

How it works...

This is one of the functions that has been around for some time but people don't know about. It not only syncs the presentation but also links up all the workflow elements inputs as INPUTs.

Locking elements


We will have a quick look at the locking mechanism of Orchestrator.

Getting ready

For locking workflows, we need a workflow that we can use to lock, primarily, a workflow that calls other actions or workflows. If you don't have one in hand, use the 06.06.01 Using Asynchronous Workflows example workflow.

How to do it...

There are only two options in the locking system.

Locking workflows

To lock a workflow, action, or package, follow these steps:

  1. Right-click on a workflow, action, or package.

  2. Navigate to Locking | Lock or Locking | Lock with dependencies. The Lock with dependencies option will lock all subworkflows and subactions that are used in this workflow.

Notice that the little lock icon on the item you have locked; you will not be able to edit this workflow anymore. However, you are still able to run it.

Unlocking workflows

Unlocking should be obvious now. However, note that there is no unlock with dependencies option, which means that you have to unlock each element by itself...

lock icon The rest of the chapter is locked
You have been reading a chapter from
VMware vRealize Orchestrator Cookbook. - Second Edition
Published in: Nov 2016 Publisher: Packt ISBN-13: 9781786462787
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}

Section

Description

Versions

This is a summary of all existing versions this workflow has, including the create date, create user, and any comments you have made regarding this version.

Inputs

This contains a list of all the in-parameters of the workflow as well as their type and description.

Outputs

This...