The second approach requires you to first enable the com.vmware.js.allow-local-process property to allow Linux processes to be executed in the vco-app (Orchestrator) pod.
CLI command: vracli vro properties set -k com.vmware.js.allow-local-process -v true
Workflow JavaScript: var cmd = new Command('printenv'); cmd.execute(true); var out = cmd.output; var prop = "-Dvco.app.hostname="; var posStart = out.indexOf(prop); var posSpace = out.indexOf(" ", posStart); var hostname = out.substring(posStart + prop.length, posSpace); System.log("Hostname = '" + hostname + "'");
It is also possible to create a custom configuration element on each Orchestrator host which contains its hostname, and then query this in the workflow.