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 examples
Section titled “The examples”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.
What changed since vRO 7
Section titled “What changed since vRO 7”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.
js-io-rights.conf rules allowed on the appliance's own file system./var/run/vco is the writable place.