Passing data between jobs¶
https://www.rundeck.com/blog/output-processing-data-passing-preview
https://github.com/rundeck/rundeck/issues/3038#issuecomment-355629323
First job :¶
Name: CheckServerConnection
Just below Global log filter
- Click on Add
- Select Key Value Data
- Don’t touch the pattern (for this example) and click on save
- Add a Step => Script
In the script we are checking the connection to different server and echoing the name of the one first available from a list.
echo RUNDECK:DATA:ServerKey=$host
You need to add RUNDECK:DATA: because that’s what the regex is about. ServerKey is our keyname that will be used after. $host is the name of the server in a variable, you can add it directly if you want.
- Add a second step, Workflow Step => Global Variable and put the following in the fields :

Replace localnodename with the localname of the rundeck server (unfortunatly without it I can’t get the variable).
Select Execute Locally
Save the job
Second job¶
Name: ServerScript
Add an option name node
The script contain a simple echo $HOSTNAME
in the nodes fields, select Dispatch to nodes and enter this in the filter field : ${option.node}
Third job¶
I named it “Link Connection - ServerScript” (first job, second job)
/!\ I need to check if this part is still needed
Just below Global log filter
- Click on Add
- Select Key Value Data
- Don’t touch the pattern (for this example) and click on save
/!\
- Add a step => Job Reference => Select the first job. Now the ServerKey is available in Export thanks to the global variable.
- Add a step => Job Reference => Select the second job and in argument put
-node ${export.ServerKey}
Voilà !
The ServerKey is passed to the third job who replace it in the node filter and the job is executed on this node.