I have a job in Rundeck v5.2.0, that runs a PowerShell script on remote 'NODE1' and outputs either 'True' or 'False'. I want to use "Invoke-WebRequest" to send that output to 'NODE2'. But 'NODE1' doesn't have access on 'NODE2'. The Rundeck server does have access on 'NODE2' though.
So, I have to somehow save the output from 'NODE1' and create another step or job in Rundeck, that will take the output from 'NODE1' and run "Invoke-WebRequest" to send it on 'NODE2'.
To be clear, Rundeck has to take the output from the job that was run on 'NODE1' and run a PowerShell script on itself, to send the output on 'NODE2'.
How can I do this?
Two jobs: the first one dispatched to the node00
, executes a command, and stores the result in a data value. In this job, you can call another job (via the job reference step) dispatched to node01
with a specific option, this option "receives" the data value from the first job.
I made an example (tested on Rundeck 5.2).
JobONE:
- defaultTab: nodes
description: ''
executionEnabled: true
id: 6eeb1cdc-b17d-4c05-9511-a80cdea2212a
loglevel: INFO
name: JobONE
nodeFilterEditable: false
nodefilters:
dispatch:
excludePrecedence: true
keepgoing: false
rankOrder: ascending
successOnEmptyNodeFilter: false
threadcount: '1'
filter: node00
nodesSelectedByDefault: true
plugins:
ExecutionLifecycle: {}
scheduleEnabled: true
sequence:
commands:
- exec: echo "universe"
plugins:
LogFilter:
- config:
invalidKeyPattern: \s|\$|\{|\}|\\
logData: 'true'
name: mydata
regex: (.*)
replaceFilteredResult: 'false'
type: key-value-data
- jobref:
args: -myoption ${data.mydata}
group: ''
name: JobTWO
nodeStep: 'true'
uuid: fa0e282d-7ebe-4d88-bf10-709cfd4c0fb2
keepgoing: false
strategy: node-first
uuid: 6eeb1cdc-b17d-4c05-9511-a80cdea2212a
JobTWO:
- defaultTab: nodes
description: ''
executionEnabled: true
id: fa0e282d-7ebe-4d88-bf10-709cfd4c0fb2
loglevel: INFO
name: JobTWO
nodeFilterEditable: false
nodefilters:
dispatch:
excludePrecedence: true
keepgoing: false
rankOrder: ascending
successOnEmptyNodeFilter: false
threadcount: '1'
filter: node01
nodesSelectedByDefault: true
options:
- name: myoption
value: world
plugins:
ExecutionLifecycle: {}
scheduleEnabled: true
sequence:
commands:
- exec: echo "hello ${option.myoption}"
keepgoing: false
strategy: node-first
uuid: fa0e282d-7ebe-4d88-bf10-709cfd4c0fb2
Check the result here.