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 7. Interacting with Orchestrator

In this chapter, we will have a closer look at how you can interact with Orchestrator. We will be looking at the following recipes:

  • User management

  • User preferences

  • Using Orchestrator through the vSphere Web Client

  • Accessing Orchestrator REST API

  • Accessing the Control Center via REST plugin

  • Running Orchestrator workflows using PowerShell

  • Using PHP to access the REST API

Introduction


Orchestrator has a REST-based API that allows you to interact with workflows as well as a lot more. We will be exploring this in this chapter in more detail.

Orchestrator used to have a SOAP API but it was discontinued; however, the VMware document vrealize-orchestrator-70-develop-web-services-guide.pdf still contains a chapter on it. So don't be mislead. Orchestrator SOAP is gone.

The REST API, in my opinion, is better and easier to use, especially as we have the fabulous Swagger UI to go and play with it (see the recipe Accessing Orchestrator REST API in this chapter).

Orchestrator can be accessed in a lot of ways, but they all come down to using the REST API.

User management


In this recipe, we will see how to control access to Orchestrator. You will learn how to give and control access to users outside the Orchestrator administrator group.

Getting ready

We need a running Orchestrator configured either with vSphere / vRA authentication or AD. Check the recipe Configuring an external Authentication in Chapter 1, Installing and Configuring Orchestrator.

Also, we need either access to a user management system (LDAP, SSO, or AD) or to have other users and groups on a given user management system. If you are using the Orchestrator appliance without any external authentication you can use the local LDAP user vcoadmin and vrouser which are set out in the recipe Configuring an external Authentication in Chapter 1, Installing and Configuring Orchestrator.

How to do it...

We have three parts to this recipe, each for different tasks.

Giving non-administrative users access to Orchestrator

Giving restricted access to users is better than just adding everyone to the...

User preferences


In this recipe, we will have a look at how to configure the behavior of Orchestrator Client. You will learn how to manipulate the coloring of scripts, the start-up behavior, and much more.

Getting ready

We need a running Orchestrator installation as well as an Orchestrator account that we can log into.

How to do it...

  1. Log into Orchestrator Client.

  2. Click on Tools (in the top-right corner of Orchestrator) and select User preferences....

  3. The User Preferences window will open.

  4. Configure the settings as you like.

  5. Click on OK.

The user preferences have four areas of configuration: General, Workflow, Inventory, and Script Editor.

How it works...

The user preferences can only be set by Orchestrator administrators, as they determine how Orchestrator Client behaves.

The user preference settings are specific for each user and are stored in the vmware-vmo.cfg file that is located in the local Orchestrator Client directory. If you are using Java Web Start (from the Orchestrator home page), the...

Using Orchestrator though the vSphere Web Client


In this recipe, we further explore the Orchestrator integration into vSphere Web Client. You will learn how to run Orchestrator workflows using vSphere Web Client as well as how to configure workflows so that they work with it.

Getting ready

You find the base information on how to integrate Orchestrator into the vSphere Web Client in the recipe Connecting to vCenter in Chapter 1, Installing and Configuring Orchestrator.

For this recipe, we need Orchestrator integrated into vSphere Web Client.

How to do it...

This recipe is made up of two parts, the configuration and the passing along of information between the Web Client and Orchestrator.

Configure workflows for the vSphere Web Client

We now configure workflows for use with the vSphere Web Client:

  1. Open the vSphere Web Client in a web browser.

  2. Log in to vCenter with a user that is a member of the Orchestrator admin group that you configured in vSphere authentication (see recipe Configuring an external...

Accessing Orchestrator REST API


In this recipe, we are looking at how to access and play with the Orchestrator REST API.

Getting ready

We need a browser, preferably Chrome or Firefox.

To play and explore, we also need access to the Orchestrator Control Center.

We will be using the example workflow 07.02 Access via PowerShell (Input).

How to do it...

The recipe is broken up into multiple parts for easier reading; the best way forward is to work through one after the other.

Accessing the API documentation and enable "play mode"

Note

Please note that this is a stetting that you shouldn't use in any production environments.

  1. Open the Orchestrator Control Center and enter the system property com.vmware.o11n.sso.basic-authentication.enabled = true as shown in section System properties in the recipe Control Center titbits in Chapter 2, Optimizing Orchestrator Configuration.

  2. Open a browser and browse to https://[Orchestrator]:8281/vco/api/docs/

  3. The SwaggerUI of Orchestrator will open up.

Try it out!

Let's give...

Accessing the Control Center via the REST plugin


In this recipe, we have a closer look at the Orchestrator Control Center.

Getting ready

We need access to the Orchestrator Control Center.

Add the Orchestrator Control Center to the REST plugin as shown in the recipe Working with REST in Chapter 9, Essential Plugins .

How to do it…

The recipe has been broken up into several sections, just work through them.

Explore the Control Center API

We will be having a look at the possibilities of the Control Center API:

  1. Open a browser to the URL and authenticate with your Control Center account: https://[Orchestrator]:8283/vco-controlcenter/docs/

  2. You now are connected to the swagger UI, which helps you explore the Control Center API.

  3. Expand server-controller and check out GET /api/server/status and POST /api/server/status/start. We used these functions in recipe Working with REST in Chapter 9, Essential Plugins.

Adding start and stop calls

Create control workflows for your Remote Orchestrators.

  1. Check out the...

Running Orchestrator workflows using PowerShell


In this recipe, we will showcase how to run an Orchestrator workflow using PowerShell.

Getting ready

We need a Windows host that has PowerShell installed (which should be any modern version of Windows). VMware PowerCLI is not needed.

The PowerShell host needs to be able to connect to Orchestrator on TCP port 8281.

If you are new to REST or the Orchestrator REST API, you may like to work through the recipe Accessing Orchestrator REST API in this chapter first.

How to do it...

All PowerShell scripts shown here are also stored as a resource with the example package.

Run a workflow

We will start by just running a workflow that doesn't require any input. We will be accessing the example workflow 07.01 Access via PowerShell.

  1. Create a new empty PowerShell script. For example, use Editor:

  2. Write the following code:

          #some basic variables 
          $usr = 'vroadmin@mylab.local' 
          $pwd = 'What4Ever' 
          $vroServer = '192.168.220.12:8281...

Using PHP to access the REST API


In this recipe, we will quickly look at how you can build an easy webpage using PHP to access the Orchestrator REST API.

Getting ready

We will make our life a bit easier and use a bit of help with PHP and REST. We will use Nate Good's HTTPFUL, which you can find at http://phphttpclient.com/ .

You need to download the following file, httpful.phar, from his website and place it in the same directory as your script.

You also need a Webserver that uses PHP and has cURL activated. I used LAMP stack from Turnkey https://www.turnkeylinux.org/lampstack . See the There's more section for a fast how-to.

How to do it...

This is a quick intro only:

  1. Edit a file such as callWorkflow.php

  2. Enter the following code:

          <?php 
          include('./httpful.phar'); 
     
          $usr = 'vroadmin@mylab.local'; 
          $pwd = 'What4Ever'; 
          $vroServer = '192.168.220.12:8281'; 
          // Example Workflow "07.01 Access via PowerShell" 
          $wfid = ...
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}