Search code examples
rundeck

Local json file to fill "allowed values" option in Rundeck


I have a list of options in json format residing within Rundeck's server which I would like to use for filling out the "Allowed values" parameter in a new option. The documentation states: "It must be accessible via HTTP(S) or on the local disk for the Rundeck server.", but sticking the path of the file fails the option generation and I could not see any example of it.

Would someone have an idea?

Thanks in advance


Solution

  • You need to use file:\ to access the file locally (at "Allowed values"), take a look at this example:

    video.json file:

    [
     {"name":"youtube", "value":"youtube.com"},
     {"name":"twitch", "value":"twitch.tv"}
    ]
    

    job definition file (here how to import to your Rundeck instance for testing):

    <joblist>
      <job>
        <context>
          <options preserveOrder='true'>
            <option enforcedvalues='true' name='video_service' valuesUrl='file:/path/to/video.json' />
          </options>
        </context>
        <defaultTab>nodes</defaultTab>
        <description></description>
        <executionEnabled>true</executionEnabled>
        <id>4be0ef08-889a-4366-ba29-0b0302fb5391</id>
        <loglevel>INFO</loglevel>
        <name>AllowedValues</name>
        <nodeFilterEditable>false</nodeFilterEditable>
        <plugins />
        <scheduleEnabled>true</scheduleEnabled>
        <sequence keepgoing='false' strategy='node-first'>
          <command>
            <exec>echo "video platform: ${option.video_service}"</exec>
          </command>
        </sequence>
        <uuid>4be0ef08-889a-4366-ba29-0b0302fb5391</uuid>
      </job>
    </joblist>
    

    Here how the job looks and here the result.