{ "nodes": [ { "name": "On clicking 'execute'", "type": "n8n-nodes-base.manualTrigger", "position": [ 250, 300 ], "parameters": {}, "typeVersion": 1, "id": "rundeck-job-runner-trigger" }, { "id": "rundeck-job-runner-run", "name": "Request Rundeck execution", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 520, 300 ], "parameters": { "method": "POST", "url": "https://rundeck.example.com/api/17/job/YOUR_JOB_ID/run", "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "sendHeaders": true, "headerParameters": { "parameters": [ { "name": "Accept", "value": "application/json" } ] }, "sendBody": true, "contentType": "json", "specifyBody": "json", "jsonBody": "{\"argString\":\"\"}", "options": { "timeout": 30000, "redirect": { "redirect": { "followRedirects": false } }, "response": { "response": { "responseFormat": "json", "fullResponse": true, "neverError": false } } } } }, { "id": "rundeck-job-runner-check", "name": "Confirm execution request", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 740, 300 ], "parameters": { "mode": "runOnceForEachItem", "jsCode": "function readRundeckExecution(body, statusCode) {\n if (!Number.isInteger(statusCode) || statusCode < 200 || statusCode >= 300 || !body || typeof body !== 'object' || Array.isArray(body) || body.error === true) {\n throw new Error('Rundeck did not accept the execution request');\n }\n const id = body.id;\n if (!(typeof id === 'number' && Number.isInteger(id) && id > 0) && !(typeof id === 'string' && /^[0-9]+$/.test(id) && !/^0+$/.test(id))) {\n throw new Error('Rundeck did not return an execution ID');\n }\n return body;\n}\nasync function rundeckResult({ body, statusCode }) {\n return { execution: readRundeckExecution(body, statusCode) };\n}\n\nreturn { json: readRundeckExecution($json.body, $json.statusCode) };" } } ], "connections": { "On clicking 'execute'": { "main": [ [ { "node": "Request Rundeck execution", "type": "main", "index": 0 } ] ] }, "Request Rundeck execution": { "main": [ [ { "node": "Confirm execution request", "type": "main", "index": 0 } ] ] } }, "name": "Rundeck Job Runner", "settings": { "executionOrder": "v1" }, "active": false, "pinData": {} }