There is an issue with vCenter Orchestrator 5.1.0 not running scheduled workflows (http://kb.vmware.com/kb/2041733). The KB says it’s resolved n 5.1.0 but it appears that it’s not. Until the issue is resolved, this post will show you how to schedule vCO workflow runs.
Say you have a workflow named BackupProviderVMs that you want to run every Sunday. First you need to find the workflow’s itemHref value. You can get this by running the following and replacing the vCO URL, credentials and your workflow name:
curl -i -k -H “accept:application/xml” -H “content-type:application/xml;charset=UTF-8” -u vcoadmin:password -X GET https://vco.example.com:8281/api/workflows?conditions=name=BackupProviderVMs
In my example the value of itemHref was https://vco.example.com:8281/api/workflows/A780808080808080808080808080808064B6808001326285598060aebf2a6a5a5/
itemHref will be used in the remaining command as such:
curl -i -k -H “accept:application/xml” -H “content-type:application/xml;charset=UTF-8” -u vcoadmin:password -X GET itemHref/…
You can view existing runs for the workflow by running:
curl -i -k -H “accept:application/xml” -H “content-type:application/xml;charset=UTF-8” -u vcoadmin:password -X GET https://vco.example.com:8281/api/workflows/A780808080808080808080808080808064B6808001326285598060aebf2a6a5a5/executions
The workflow can be ran with:
curl -i -k -H “accept:application/xml” -H “content-type:application/xml;charset=UTF-8” -u vcoadmin:password -X POST https://vco.example.com:8281/api/workflows/A780808080808080808080808080808064B6808001326285598060aebf2a6a5a5/executions -d @relocate-response
Where relocate-response is a file with the contents of:
<execution-context xmlns=”http://www.vmware.com/vco”>
<parameters>
</parameters>
</execution-context>
The workflow can be scheduled to run by creating a crontab entry on the vCO server as such:
05 02 * * 0 /usr/bin/curl -i -k -H “accept:application/xml” -H “content-type:application/xml;charset=UTF-8” -u vcoadmin:password -X POST https://vco.example.com:8281/api/workflows/A780808080808080808080808080808064B6808001326285598060aebf2a6a5a5/executions -d @/usr/local/src/relocate-response
Thanks. I actually just remembered this today while working in vCO. A lot easier than the method in my post.