Advanced operations
Until now, almost everything in this book started with a click in the Orchestrator Client. In real operations that’s the exception. Workflows are started by pipelines, by scheduled jobs on other servers, by other products, and by Orchestrator itself when something happens. This chapter is about those starts: driving Orchestrator from outside, and letting it act on its own.
Recipe 7.1 opens the REST API that the client itself is built on, and shows how to authenticate to both kinds of Orchestrator in the lab, the standalone appliance and the one embedded in VCF Automation. Recipe 7.2 uses it to start a workflow from a shell script and from PowerShell, wait for it, and read its result. Recipe 7.3 turns the direction round: a policy that runs a workflow every few minutes without anyone starting it, and the plug-in events a policy can listen to. The last four recipes cover the server-side tools that keep this kind of automation in order. Recipe 7.4 labels content and plug-in objects with tags, so that workflows can find them. Recipe 7.5 uses locks to stop runs that work at the same time from overwriting each other. Recipe 7.6 keeps whole files, such as an HTML report template, on the server as resource elements. Recipe 7.7 puts a workflow on a timetable, and looks at the stored credentials that decide whether a schedule keeps running.
The examples
Section titled “The examples”| Object | Name |
|---|---|
| Workflow folder | VCF Orchestrator Guide/Chapter 7 |
| Workflow started from scripts | List VMs by name, from recipe 3.2 |
| Workflow started by a policy | Count powered-on VMs |
| Policy, in VCF Orchestrator Guide/Chapter 7 | VCF Guide VM count, with the policy run VM count every 5 minutes |
Account for scripts on vco01.vmw.lab |
svc-vcfguide@vsphere.local, a member of OrchestratorAdmins |
| Shell helpers | vro-env.sh and run-workflow.sh, written in recipes 7.1 and 7.2 |
| Action module | com.vcfguide.chapter7, with tagVm, tagVmGlobally, findVmsByTag, listLocks and scheduleReportAt |
| Workflows for locks and reports | Count a run (recipe 7.5) and Build VM report (recipe 7.6) |
| Configuration element, in VCF Orchestrator Guide/Chapter 7 | vcfguide-ch7-state, holding the counter for recipe 7.5 |
| Resource elements, in VCF Orchestrator Guide/Chapter 7 | vcfguide-vm-report.html (template) and vcfguide-vm-report-latest.html (result) |
| Tags | vcfguide, read-only, vcenter on workflows; vcfguide-owner (private) and vcfguide-backup (global) on VMs |
| Schedule | VM report every weekday, running Build VM report |
The API examples run against vco01.vmw.lab with Basic authentication, and against the Orchestrator embedded in VCF Automation at auto.vmw.lab with a bearer token. They need a Linux or macOS shell with curl and jq, or PowerShell 7. Every workflow in the chapter only reads from vc01.vmw.lab. Recipe 7.4 sets Orchestrator tags on a few VMs, which vCenter never sees. JavaScript samples are plain ES5.1.
What changed since vRO 7
Section titled “What changed since vRO 7”The REST API has been the way into Orchestrator for more than ten years, and calls written for vRO 7 still look familiar. What’s new is how you authenticate, and the products that sit in front of Orchestrator.
/vco/api with a user name and password, or through the older SOAP web service.