forked from m.lettere/orchestrator-setup
88 lines
2.8 KiB
JSON
88 lines
2.8 KiB
JSON
{
|
|
"ownerApp" : "Cloud Computation Platform",
|
|
"name" : "ccp-clean-instance",
|
|
"createBy" : "Marco Lettere",
|
|
"description": "Common workflow for cleaning an instance",
|
|
"version" : 1,
|
|
"ownerEmail" : "m.lettere@gmail.com",
|
|
"inputParameters" : ["runtime-endpoint", "instance", "instance-endpoint"],
|
|
"tasks" : [
|
|
{
|
|
"name" : "pyrest",
|
|
"taskReferenceName" : "fetch-instance",
|
|
"type" : "SIMPLE",
|
|
"accept" : "application/json",
|
|
"inputParameters" : {
|
|
"url" : "${workflow.input.instance-endpoint}/${workflow.input.instance}",
|
|
"method" : "GET",
|
|
"headers" : {
|
|
"Accept" : "application/json"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "LAMBDA_TASK",
|
|
"taskReferenceName": "init",
|
|
"type": "LAMBDA",
|
|
"inputParameters": {
|
|
"runtime" : "${workflow.input.runtime}",
|
|
"instancename" : "${fetch-instance.output.body.name}",
|
|
"scriptExpression": " return { 'instancename' : $.instancename}"
|
|
}
|
|
},
|
|
{
|
|
"name" : "pyrest",
|
|
"taskReferenceName" : "fetch-runtime",
|
|
"type" : "SIMPLE",
|
|
"inputParameters" : {
|
|
"url" : "${workflow.input.runtime-endpoint}/${fetch-instance.output.body.runtime}",
|
|
"accept" : "application/json",
|
|
"method" : "GET",
|
|
"headers" : {
|
|
"Accept" : "application/json"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name" : "pyexec",
|
|
"taskReferenceName" : "extract-destroy-playbook",
|
|
"type" : "SIMPLE",
|
|
"inputParameters" : {
|
|
"operation" : "Write",
|
|
"path" : "/tmp/destroy-playbook.yml",
|
|
"content" : "${fetch-runtime.output.body.provisioning.cleanscript}"
|
|
}
|
|
},
|
|
{
|
|
"name" : "pyrest",
|
|
"taskReferenceName" : "update-instance-status-cleaning",
|
|
"type" : "SIMPLE",
|
|
"inputParameters" : {
|
|
"url" : "${workflow.input.instance-endpoint}/${fetch-instance.output.body.id}/status",
|
|
"method" : "PUT",
|
|
"body" : { "status" : "CLEANING"}
|
|
}
|
|
},
|
|
{
|
|
"name" : "pyexec",
|
|
"taskReferenceName" : "destroy-instance",
|
|
"type" : "SIMPLE",
|
|
"inputParameters" : {
|
|
"operation" : "Ansible",
|
|
"playbook" : "${fetch-runtime.output.body.provisioning.cleanscript}",
|
|
"extra_vars" : "${init.output.result}"
|
|
}
|
|
},
|
|
{
|
|
"name" : "pyrest",
|
|
"taskReferenceName" : "update-instance-status-completed",
|
|
"type" : "SIMPLE",
|
|
"inputParameters" : {
|
|
"url" : "${workflow.input.instance-endpoint}/${fetch-instance.output.body.id}/status",
|
|
"method" : "PUT",
|
|
"body" : { "status" : "COMPLETED"}
|
|
}
|
|
}
|
|
]
|
|
}
|