Using Variable in Job Option Path

29 views
Skip to first unread message

Sandra French

unread,
Oct 17, 2022, 11:16:00 AM10/17/22
to rundeck-discuss
Hi!

I am trying to use a variable in a path to a remote job option like this:
file:/$RDECK_BASE/projects/Terraform/environmentOptions.json 

However, the variable isn't being understood/read by Rundeck (despite being able to echo $RDECK_BASE in the browser command line successfully).

I'm getting a file not found exception because Rundeck is reading the path literally, instead of the value of $RDECK_BASE followed by the rest of the path.

Any ideas how to fix/workaround this? Any guidance would be much appreciated.

Thanks in advance!!

rac...@rundeck.com

unread,
Oct 17, 2022, 11:45:06 AM10/17/22
to rundeck-discuss

Hi!

The best way to do that is:

  1. Declare a Rundeck-wide global execution variable in the framework.properties file:

    a) Stop the Rundeck service.
    b) Open the framework.properties file with your favorite text editor and add this line: framework.globals.rundeck_path=/your/rundeck/path then save it.
    c) Start the Rundeck service.

  2. In your job, define the remote option in the following way: file:${globals.rundeck_path}/options.json

Now you can use that global execution variable as the $RDECK_BASE shell env var.

Take a look at this to get more info.

Hope it helps!

Reply all
Reply to author
Forward
0 new messages