Skip to content

Working with plug-ins

Chapters 3 and 4 built workflows and the scripts inside them, and almost every example worked on vCenter. That was a plug-in at work. This chapter is about the others: the plug-ins that let a workflow call an API, log in to a server, or keep records in a database, and so reach systems that VMware never wrote a plug-in for.

Recipe 5.1 takes a plug-in apart, to show what it adds to Orchestrator and where to find it: types for scripts, objects in the inventory, and ready-made workflows. It also covers installing a third-party plug-in. The next three recipes each put one of the built-in plug-ins to work. Recipe 5.2 registers a REST API and calls it from an action, with the login and logout most APIs expect. Recipe 5.3 gives Orchestrator its own SSH key, runs commands on a Linux host, and copies files both ways. Recipe 5.4 connects a PostgreSQL database and writes and reads rows without opening the door to SQL injection.

The second half of the chapter is about telling people and systems what happened. Recipe 5.5 sets up mail and sends an HTML report. Recipe 5.6 is about the two text formats everything else uses, JSON and XML, and the conversions between them and Orchestrator’s own objects. Recipe 5.7 publishes those JSON documents to a RabbitMQ queue and starts a workflow when a message arrives. Recipe 5.8 covers the plug-in many teams reach for first: Active Directory users and groups. Recipe 5.9 adds SOAP, for older systems that have no REST API.

The pattern is the same in every recipe: run the plug-in’s configuration workflow once to register the system, try it with a built-in workflow, then do the real work in an action.

Object Name
Action module com.vcfguide.chapter5
Workflow folder VCF Orchestrator Guide/Chapter 5
REST host vc01-rest, the REST API of vc01.vmw.lab
SSH host syslog01.vmw.lab, user vcfguide
Database db01-vcfguide, PostgreSQL database vcfguide on db01.vmw.lab
Mail server mail01.vmw.lab, port 587 with STARTTLS, sender vcfguide@vmw.lab
AMQP broker mq01, RabbitMQ on mq01.vmw.lab; exchange vcfguide.events, queue vcfguide.vm-facts
Active Directory dc01.vmw.lab over LDAPS, domain vmw.lab, OU VCF Guide, group vcfguide-users
SOAP host vc01-soap, the SOAP API of vc01.vmw.lab

The examples read from the lab and write only to places they own: the /tmp folder of syslog01.vmw.lab, one table in the vcfguide database, one exchange and queue on the broker, and one OU in Active Directory. The REST examples use the read-only vCenter account svc-vcfguide-ro@vsphere.local from Chapter 4. JavaScript samples are plain ES5.1.

The plug-ins in this chapter have been part of Orchestrator for more than ten years, and their scripting objects have barely changed. Scripts written for vRO 7 against RESTHost, SSHSession, or SQLDatabase mostly still run. What changed is how you manage plug-ins and where their files live.

Back in vRO 5.5–7Install and configure plug-ins in Control Center on port 8283, and restart the Orchestrator service by hand.
In Orchestrator 9.xInstall plug-ins in the Orchestrator Client under System Settings > Plug-ins; the server restarts by itself. Connections to REST hosts, SSH hosts, and databases are made with configuration workflows, as before.
Back in vRO 5.5–7Scripts read and write files anywhere the js-io-rights.conf rules allowed on the appliance's own file system.
In Orchestrator 9.xThe server runs in a Kubernetes container. Scripts and SCP copies see the container's file system, where /var/run/vco is the writable place.