7.5.3. Step 3: Create A New Workflow
In this session, you will customize a RackHD workflow to implement your own logic.
Workflow Scenario
You have a number of new bare metal servers coming online.
- Before the OS and applications are deployed to the new servers, you want to run a quick sanity check (diagnostic) on the servers.
- Due to a special demand of your application, you want to include a temperature check and CPU frequency check in the diagnostic step.
To fulfill the demand of scenario, you can use On-Web-UI to customize a new workflow named My_Workflow.
This example is a simple one. However, your customized workflows can be as complex as needed.
“Workflow” in RackHD
A workflow in RackHD is a JSON document, which describes a flow of execution and is built as a graph. A graph is composed by several tasks.
The tasks can be executed in serial or in parallel. Each task has a conditional output that can be used to drive the workflow down different paths based on how the task is completed (for example, Error, Failed, Succeeded).
7.5.3.1. Add A New Workflow
- Click the Workflow Editor button on the left panel.
- Type your workflow name (My_Workflow)
- Press Enter on your keyboard. Do not use the Save button on the right.
- On the pop up Confirm diagram, click “SUBMIT”
The Web-UI refreshes itself.
- Click the Workflow Editor button on the left panel.
- Type My_Workflow on the name box. The name is auto-populated. You can select the workflow you created.
The on-web-ui will show there’s a dummy operation (no-op) in this workflow.
- Use your mouse wheel to zoom in and zoom out on the view.
- Drag and drop from left to right to move the view point.
- On the right side, above the panel that displays the workflow source code, in the Task field, type Set Node Pxeboot, to select an existing task.
- Click the + button, to add the task to your customized workflow.
- Then a piece of workflow source code(json) will be appended into your workflow code .
- On the left view, a new “task box” appeared, it will be named as “new-task-xxxxxx” (xxxxxx is randomly generated)
- To make the name more readable, please change the label name from “new-task-xxxxxx” to “set-boot-pxe” (by clicking the string on the box then you can edit it.)
- As below example, the newly added box has been renamed to set-boot-pxe.
- Select the existing task Reboot Node.
- Click the + button. The new task is added to the source code and a new task box is added to the visual editor.
- Change the box name from random generated string to reboot.
[Note]
Besides, you need to edit the code block of Reboot, as is shown in the picture above.
- Select the existing task Boostrap Ubuntu
- Click the + button.
- Change the newly added box name to boostrap-ubuntu
7.5.3.2. Customize A Shell Command Task
- In the Task field, type Shell commands, to add a task.
- Click the + button.
- Change the new task’s name to Diagnostic by clicking the name on the box.
- In the workflow editor window on the right hand side, you can see three default shell commands for the Diagnostic task that you created.
The following example shows the default, automatically generated, json output.
"commands": [
{
"command": "sudo ls /var",
"catalog": {
"format": "raw",
"source": "ls var"
}
},
{
"command": "sudo lshw -json",
"catalog": {
"format": "json",
"source": "lshw user"
}
},
{
"command": "test",
"acceptedResponseCodes": [ 1 ]
}
]
7.5.3.3. Set The Task Relationship
Tasks display indicators that you can connect to set the task relationship. Each task displays a trigger indicator in the top left.
Each task also displays the following condition indicators on the right side:
- Red: when fail
- Green: when success
- Blue: when finish
For example, when you connect the green condition indicator of task A to the trigger indicator for Task B: when task A has succeeded, then task B is triggered.
- Connect the blue condition indicator of the set-boot-pxe task to the trigger indicator of the reboot task: whether the set-boot-pxe task is successful or not, the reboot task is triggered
- Connect the green condition indicator of the reboot task to the trigger indicator of the bootstrap-ubuntu task.
When the reboot task is successfully completed, the bootstrap-ubuntu task is started.
Note: Use your mouse wheel to zoom in and zoom out on the view. Drag and drop from left to right to move the view point.
- Click x to remove the no-op task.
- Connect the green condition indicator for the reboot task to the trigger indicator for the Diagnostic task.
- View your new workflow.
7.5.3.4. Save The Workflow
- Click the save icon to save the workflow