forked from m.lettere/orchestrator-setup
75 lines
2.5 KiB
JSON
75 lines
2.5 KiB
JSON
{
|
|
"ownerApp" : "Cloud Computation Platform",
|
|
"name" : "ccp-launch-runtime",
|
|
"createBy" : "Marco Lettere",
|
|
"description": "Common workflow for launching a runtime",
|
|
"version" : 1,
|
|
"ownerEmail" : "m.lettere@gmail.com",
|
|
"inputParameters" : ["runtime", "runtime-endpoint", "instance-name", "instance-endpoint"],
|
|
"tasks" : [
|
|
{
|
|
"name": "LAMBDA_TASK",
|
|
"taskReferenceName": "init",
|
|
"type": "LAMBDA",
|
|
"inputParameters": {
|
|
"runtime" : "${workflow.input.runtime}",
|
|
"instancename" : "${workflow.input.instance-name}",
|
|
"scriptExpression": "var instname = ($.instancename != null ? $.instancename : 'auto-' + $.runtime + '-' + (Math.abs((Math.random() * 10e11)|0))); return { 'instancename' : instname}"
|
|
}
|
|
},
|
|
{
|
|
"name" : "pyrest",
|
|
"taskReferenceName" : "create-instance",
|
|
"type" : "SIMPLE",
|
|
"inputParameters" : {
|
|
"url" : "${workflow.input.instance-endpoint}",
|
|
"method" : "POST",
|
|
"body" : { "name" : "${init.output.result.instancename}", "status" : "NONE", "runtime" : "${workflow.input.runtime}", "method" : "none"}
|
|
}
|
|
},
|
|
{
|
|
"name" : "pyrest",
|
|
"taskReferenceName" : "fetch-runtime",
|
|
"type" : "SIMPLE",
|
|
"inputParameters" : {
|
|
"url" : "${workflow.input.runtime-endpoint}/${workflow.input.runtime}",
|
|
"accept" : "application/json",
|
|
"method" : "GET",
|
|
"headers" : {
|
|
"Accept" : "application/json"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name" : "pyexec",
|
|
"taskReferenceName" : "extract-start-playbook",
|
|
"type" : "SIMPLE",
|
|
"inputParameters" : {
|
|
"operation" : "Write",
|
|
"path" : "/tmp/start-playbook.yml",
|
|
"content" : "${fetch-runtime.output.body.provisioning.startscript}"
|
|
}
|
|
},
|
|
{
|
|
"name" : "pyexec",
|
|
"taskReferenceName" : "start-instance",
|
|
"type" : "SIMPLE",
|
|
"inputParameters" : {
|
|
"operation" : "Ansible",
|
|
"playbook" : "${fetch-runtime.output.body.provisioning.startscript}",
|
|
"extra_vars" : "${init.output.result}"
|
|
}
|
|
},
|
|
{
|
|
"name" : "pyrest",
|
|
"taskReferenceName" : "update-instance-status-executing",
|
|
"type" : "SIMPLE",
|
|
"inputParameters" : {
|
|
"url" : "${workflow.input.instance-endpoint}/${create-instance.output.body.id}/status",
|
|
"method" : "PUT",
|
|
"body" : { "status" : "EXECUTING"}
|
|
}
|
|
}
|
|
]
|
|
}
|