Quick example:
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][1]) dispatched to `node01` with a specific option, this option "[receives][2]" the data value from the first job.
I made an example (tested on Rundeck 5.2).
JobONE:
```yaml
- 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:
```yaml
- 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][3].
[1]: https://docs.rundeck.com/docs/manual/node-steps/builtin.html#job-reference-step
[2]: https://docs.rundeck.com/docs/learning/howto/env-in-notifications.html
[3]: https://imgur.com/WqoHVDU
I replicated your scenario and your issue. Checking your model source entry, I'm sure that you want to use an option as a password to authenticate and execute the `sudo` commands, let me share a node entry and job definition example:
Node definition example (tested on remote Ubuntu 22.04 and Rocky Linux 8 servers):
```xml
<?xml version="1.0" encoding="UTF-8"?>
<project>
<node name="ubuntu"
description="ubuntu"
tags="prod"
hostname="192.168.56.12"
osArch="amd64"
osFamily="unix"
osName="Linux"
osVersion="5.11.0-49-generic #55-Ubuntu SMP"
always-set-pty="true"
username="vagrant"
ssh-authentication="password"
ssh-password-storage-path="keys/sudopasswd"
sudo-command-enabled="true"
sudo-command-pattern="^sudo$"
sudo-prompt-pattern="^\[sudo\] password for .+: .*"
sudo-password-option="option.sudoPassword" />
</project>
```
As you see, the `sudo-command-pattern` is different and you need to add the `sudo-prompt-pattern` attribute which "receives" the `sudo` prompt to put the password automatically.
Job Definition Example:
```yaml
- defaultTab: nodes
description: ''
executionEnabled: true
id: 57262967-00f1-4e5e-b872-57ace765daee
loglevel: INFO
name: TestSUDO
nodeFilterEditable: false
nodefilters:
dispatch:
excludePrecedence: true
keepgoing: false
rankOrder: ascending
successOnEmptyNodeFilter: false
threadcount: '1'
filter: 'name: ubuntu '
nodesSelectedByDefault: true
options:
- name: sudoPassword
required: true
secure: true
plugins:
ExecutionLifecycle: null
scheduleEnabled: true
sequence:
commands:
- description: 'first test: using the command step'
exec: sudo whoami
- description: 'second test: on script step'
fileExtension: .sh
interpreterArgsQuoted: false
script: |
sudo whoami
scriptInterpreter: sudo /bin/bash
keepgoing: false
strategy: sequential
uuid: 57262967-00f1-4e5e-b872-57ace765daee
```
Some things to consider:
1) The option named in the `sudo-password-option` node entry (`sudoPassword` on the job), must be a [Secure Remote Authentication][1] Option.
2) The `sudo` attributes work flawlessly on command steps, that's a little different on script steps (next point).
3) On Script steps (like your use-case), it needs to define the `sudo` command in the Invocation String textbox (Edit your job > Go to your script step > click on the Advanced link > Invocation string), in my case, I used `sudo /bin/bash` with `.sh` as File Extension.
Check the result [here][2].
[1]: https://docs.rundeck.com/docs/manual/job-options.html#secure-remote-authentication-options
[2]: https://i.sstatic.net/NHFEX.jpg