passing and processing data between jobs

35 views
Skip to first unread message

Jerome vd

unread,
Aug 20, 2025, 9:06:28 AMAug 20
to rundeck-discuss
Hello , 

I'm new to Rundeck, I have version 4.0. 
I've looked at the documentation quite a bit, and I can't get one of my jobs to complete.
 The project is to run a script (inline script) on several nodes to extract expired or expiring accounts. 
The script works very well; I saved the result in the form host;user;expiry_date. 

Then I'd like to process all the results in order to sort them correctly. 
- I first tried to create a second one and run it locally or on a specific node only once, but I couldn't find the option. 
- Afterwards, I tried with the reference jobs, the options, and the log filters, but I can't get anything done; the data doesn't pass between my two jobs.

 Do you have any working examples?


My job1 Yaml :
- defaultTab: nodes
description: |
Job1 : capture les comptes proches de l'expiration
et passe les données à Job2
executionEnabled: true
id: 5f6a7c3b-abcdef12-3456-7890-fedcba9
loglevel: INFO
name: Expiration_Compte_Linux
nodeFilterEditable: true
nodefilters:
dispatch:
excludePrecedence: true
keepgoing: false
rankOrder: ascending
successOnEmptyNodeFilter: false
threadcount: '4'
filter: servertest.*
nodesSelectedByDefault: true
plugins:
ExecutionLifecycle: {}
scheduleEnabled: true
sequence:
commands:
- autoSecureInput: 'false'
description: Capture des données d'expiration
passSecureInput: 'false'
plugins:
LogFilter:
- config:
captureMultipleKeysValues: 'true'
hideOutput: 'true'
logData: 'true'
regex: ^(.+?)\s*=\s*(.+)
type: key-value-data-multilines
script: |-
#!/bin/bash
THRESHOLD=30
TODAY=$(date +%s)
HOST=$(hostname -s)

translate_months_to_english() {
echo "$1" | sed -e 's/janvier/January/i' -e 's/janv[.]*/Jan/i' \
-e 's/février/February/i' -e 's/févr[.]*/Feb/i' \
-e 's/mars/March/i' \
-e 's/avril/April/i' -e 's/avr[.]*/Apr/i' \
-e 's/mai/May/i' \
-e 's/juin/June/i' \
-e 's/juillet/July/i' -e 's/juil[.]*/Jul/i' \
-e 's/août/August/i' \
-e 's/septembre/September/i' -e 's/sept[.]*/Sep/i' \
-e 's/octobre/October/i' -e 's/oct[.]*/Oct/i' \
-e 's/novembre/November/i' -e 's/nov[.]*/Nov/i' \
-e 's/décembre/December/i' -e 's/déc[.]*/Dec/i'
}

for user in $(cut -d: -f1 /etc/passwd); do
expiry=$(sudo chage -l "$user" 2>/dev/null \
| grep "Password expires" | cut -d: -f2- | xargs)
if [[ -n "$expiry" && "$expiry" != "never" ]]; then
expiry_eng=$(translate_months_to_english "$expiry")
exp_secs=$(date -d "$expiry_eng" +%s 2>/dev/null)
if [[ $? -eq 0 ]]; then
days_left=$(( (exp_secs - TODAY) / 86400 ))
if (( days_left <= THRESHOLD )); then
formatted=$(date -d "@$exp_secs" +%d/%m/%Y)
echo "expdata = ${HOST};${user};${formatted}"
fi
fi
fi
done
- jobref:
args: expdata=${data.expdata*}
group: ''
importOptions: true
name: Traitement_Expiration_Comptes
uuid: febe805f-5544-47c1-a310-7be78c94b3af
keepgoing: false
strategy: node-first
uuid: 5f6a7c3b-abcdef12-3456-7890-fedcba9


Job2 :
- defaultTab: nodes
  description: 'Job2: affiche les données reçues'
  executionEnabled: true
  id: febe805f-5544-47c1-a310-7be78c94b3af
  loglevel: INFO
  name: Traitement_Expiration_Comptes
  nodeFilterEditable: false
  nodefilters:
    dispatch:
      excludePrecedence: true
      keepgoing: false
      rankOrder: ascending
      successOnEmptyNodeFilter: false
      threadcount: '1'
    filter: spahd-pad.*
  nodesSelectedByDefault: true
  options:
  - name: expdata
  plugins:
    ExecutionLifecycle: {}
  scheduleEnabled: true
  sequence:
    commands:
    - autoSecureInput: 'false'
      description: Affiche la donnée reçue
      passSecureInput: 'false'
      script: |-
        #!/bin/bash
        echo "Job2 a reçu : @option.expdata@"
    keepgoing: false
    strategy: sequential
  uuid: febe805f-5544-47c1-a310-7be78c94b3a

output :
Screenshot_20250820_144531.png
 Sincerely,

Jerome vd

unread,
Aug 20, 2025, 9:18:17 AMAug 20
to rundeck-discuss
I use version 5.14.1 sorry

Jerome vd

unread,
Aug 25, 2025, 4:55:42 AM (14 days ago) Aug 25
to rundeck-discuss
Can you point me to an example of a functional job that, for example,
- Job1 : runs an echo hostname on a list of nodes 
- Job2 (Childjob)  that displays them (on 1 node) by calling cat hostname (pass as argument)?

rac...@rundeck.com

unread,
Aug 26, 2025, 9:21:51 AM (13 days ago) Aug 26
to rundeck-discuss
Hi Jerome,

Take a look at this.

Regards.

Jerome vd

unread,
Aug 27, 2025, 3:37:03 AM (12 days ago) Aug 27
to rundeck-discuss
Thanks for reply, I move forward and I understand why it didn't work.
Screenshot_20250827_093143.png


and i lost option when i check Workflow Step.
without this option job2 runs as many times as I have nodes (around 150 for me)
Is it not possible to save the complete global filter for reuse in another job?


Job2 :I move forward and I understand why it didn't work
Reply all
Reply to author
Forward
0 new messages