commit 7b648c209ba9651a880d1474b3392aa049eb4227 Author: Marco Lettere Date: Wed Nov 18 17:46:04 2020 +0100 initial share diff --git a/defaults/main.yaml b/defaults/main.yaml new file mode 100644 index 0000000..37a4ad7 --- /dev/null +++ b/defaults/main.yaml @@ -0,0 +1,5 @@ +--- +target_path: "/tmp/workflows" +conductor_server: "http://conductor-dev.int.d4science.net/api" +conductor_workflowdef_endpoint: "{{ conductor_server }}/metadata/workflow" +conductor_taskdef_endpoint: "{{ conductor_server }}/metadata/taskdefs" diff --git a/tasks/main.yaml b/tasks/main.yaml new file mode 100644 index 0000000..74083ad --- /dev/null +++ b/tasks/main.yaml @@ -0,0 +1,14 @@ +--- +- name: Generate taskdefs + template: + src: "templates/taskdefs.json.j2" + dest: "{{ target_path }}/taskdefs.json" + +- name: Upload task definitions + uri: + url: "{{ conductor_taskdef_endpoint }}" + method: POST + src: "{{ target_path }}/taskdefs.json" + body_format: json + status_code: 204 + follow_redirects: yes diff --git a/templates/taskdefs.json.j2 b/templates/taskdefs.json.j2 new file mode 100644 index 0000000..17b8416 --- /dev/null +++ b/templates/taskdefs.json.j2 @@ -0,0 +1,46 @@ +[ + { + "name" : "jsr223", + "description" : "Execute JSR223 scripts", + "inputKeys" : ["code", "scriptdir", "script","engine"], + "outputKeys" : ["result"], + "ownerEmail" : "m.lettere@gmail.com" + }, + { + "name" : "pyrest", + "description" : "Execute an HTTP request with pyrest worker", + "inputKeys" : ["url", "body", "contentType", "method", "accept", "headers", "connectionTimeout", "readTimeout"], + "outputKeys" : ["body", "status", "reason", "headers"], + "ownerEmail" : "m.lettere@gmail.com" + }, + { + "name" : "pyeval", + "description" : "Execute arbitrary python code", + "inputKeys" : ["code"], + "outputKeys" : ["result"], + "ownerEmail" : "m.lettere@gmail.com" + }, + { + "name" : "pyshell", + "description" : "Execute an Shell commands on target machine. Commands are in the form of an array of objects named commands of defined as { 'line': 'ls -l', 'expect' : 0, 'withshell' : False}.", + "inputKeys" : ["commands"], + "outputKeys" : ["results"], + "ownerEmail" : "m.lettere@gmail.com" + }, + { + "name" : "pyansible", + "retryCount" : 0, + "description" : "Execute ansible playbook", + "inputKeys" : ["playbook", "hosts", "connection", "verbosity", "extra_vars", "gather_facts"], + "outputKeys" : ["ok", "failed", "unreachable"], + "ownerEmail" : "m.lettere@gmail.com" + }, + { + "name" : "pypacker", + "retryCount" : 0, + "description" : "Executes packer.io command line for build and validate. It has been isolated in order to be able to start the worker only where OS dependencies are matched.", + "inputKeys" : ["command", "template"], + "outputKeys" : ["results"], + "ownerEmail" : "m.lettere@gmail.com" + } +]