Workflow Operations Usage¶
Workflows are the top-level sequencing objects in DRP — an ordered list of stages (and optionally direct task or action references) that defines the full provisioning process for a machine. Use drpcli workflows to manage the workflow library.
List Workflows¶
# List all defined workflows
drpcli workflows list
# Show only workflow names
drpcli workflows list | jq -r '.[].Name' | sort
# Show each workflow and its stage list
drpcli workflows list | jq -r '.[] | [.Name, (.Stages | join(", "))] | @tsv' | column -t
Show a Workflow¶
# Show a specific workflow by name
drpcli workflows show ubuntu-22-04-install
# Show just the stage sequence
drpcli workflows show ubuntu-22-04-install | jq '.Stages'
Create a Workflow¶
# Create a workflow with an ordered stage list
drpcli workflows create '{
"Name": "ubuntu-22-04-install",
"Description": "Full Ubuntu 22.04 install: discover, install, configure, finalize",
"Stages": ["discover", "install-ubuntu-22-04", "configure-base", "finalize"]
}'
# Create from a YAML file
drpcli workflows create - < ubuntu-22-04-install.yaml
A workflow YAML file:
Name: ubuntu-22-04-install
Description: "Full Ubuntu 22.04 install workflow"
Stages:
- discover
- install-ubuntu-22-04
- configure-base
- configure-monitoring
- finalize
Update a Workflow¶
# Update a workflow's stage list (add a monitoring stage)
drpcli workflows update ubuntu-22-04-install \
'{"Stages":["discover","install-ubuntu-22-04","configure-base","configure-monitoring","finalize"]}'
# Update description
drpcli workflows update ubuntu-22-04-install '{"Description":"Ubuntu 22.04 with monitoring"}'
Apply a Workflow to a Machine¶
Use drpcli machines workflow to assign a workflow to a machine:
# Assign a workflow to a machine by UUID
drpcli machines workflow <machine-uuid> ubuntu-22-04-install
# Check the machine's current stage and task
drpcli machines show <machine-uuid> | jq '{Workflow:.Workflow,Stage:.Stage,Task:.CurrentTask}'
drpcli machines start forces a workflow onto a machine, resetting CurrentTask to the beginning of the stage list:
# Force a workflow onto a machine, starting from the first task
drpcli machines start <machine-uuid> ubuntu-22-04-install
The difference: machines workflow sets the workflow but does not change CurrentTask unless the workflow itself changes. machines start always resets CurrentTask to the beginning, ensuring the workflow runs from the start.
Check Workflow Progress¶
# Wait for the machine to finish the current workflow (up to 60 minutes)
drpcli machines wait <machine-uuid> WorkflowComplete true 3600
# Watch which stage is currently running
watch -n5 'drpcli machines show <machine-uuid> | jq -r '\''.Stage + "/" + .CurrentTask'\'''
# List all machines currently running a specific workflow
drpcli machines list Workflow=ubuntu-22-04-install | jq -r '.[] | [.UUID, .Stage] | @tsv'
Destroy a Workflow¶
A workflow can only be removed when no machines are currently using it:
# Check that no machines are using the workflow first
drpcli machines count Workflow=ubuntu-22-04-install
# Remove the workflow (only valid if no machines are currently using it)
drpcli workflows destroy ubuntu-22-04-install