Python comes to UCS Director!
Attached to this post is a UCSDirector Export that contains a the Custom Task Sample and an Example Workflow using it, and the related Python Script file that is being called by the Task. The Python file doesn't do anything terribly interesting, but the framework is there to enable you to run whatever you need in Python and send relevant details back to UCS Director. I'm also attaching the sample CloupiaScript text for reference as well.
Though I'll be using this primarily with Python, there is nothing that would prevent this same framework from working with any other scripting language. All that is needed is a script that can be called leveraging command line parameters that can print out JSON text. So feel free to leverage this with bash, perl, python, go, or any other language you might want to work in.
Also, you could use the UCS Director appliance itself to run the script files from, rather than need a separate host. I opted to not do this for now because the python versions shipping on the UCSD appliance are a bit older and I like to stick with at least 2.7.x.
Walkthrough of the example!
Executing the UCS Director Workflow
The Workflow Task User Inputs Screen
The Workflow Task Admin Inputs Screen
The Credential Policy for the Python Host
The Service Request Log showing the script running and returned data
The CloupiaScript for the Sample Task
The Python Script being Executed
|Name||EZ Cloud New vDC Utilities|
|Category||Workflow and Tasks|
Instructions for Regular Workflow Use:
- Download the attached .ZIP file below to your computer. *Remember the location of the saved file on your computer.
- Unzip the file on your computer. Should end up with a .WFD file.
- Log in to UCS Director as a user that has "system-admin" privileges.
- Navigate to "Policies-->Orchestration" and click on "Import".
- Click "Browse" and navigate to the location on your computer where the .WFD file resides. Choose the .WFD file and click "Open".
- Click "Upload" and then "OK" once the file upload is completed. Then click "Next".
- Click the "Select" button next to "Import Workflows". Click the "Check All" button to check all checkboxes and then the "Select" button.
- Click "Submit".