Rundeck sharing variables across job steps

Naveen Karnam picture Naveen Karnam · May 9, 2016 · Viewed 12.5k times · Source

I want to share a variable across rundeck job steps.

  1. Initialized a job option "target_files"
  2. Set the variable on STEP 1.

    RD_OPTION_TARGET_FILES=some bash command
    echo $RD_OPTION_TARGET_FILES
    The value is printed here.

  3. Read the variable from STEP 2.
    echo $RD_OPTION_TARGET_FILES

Step 3 doesn't recognize the variable set in STEP 1.
What's a good way of doing this on rundeck other than using environment variables?

Answer

Happy picture Happy · Sep 20, 2017

After Rundeck 2.9, there is a Data Capture Plugin to allow pass data between job steps.

The plugin is contained in the Rundeck application by default.

Data capture plugin to match a regular expression in a step’s log output and pass the values to later steps

Details see Data Capture/Data Passing between steps (Published: 03 Aug 2017)