job-yaml-v12 - The 'job' YAML file declares job entries for Rundeck.
This file can be batch loaded via rd-jobs load command:
rd-jobs load --file /path/to/jobs.yaml -F yaml
Rundeck job definitions can be dumped and saved to a file via rd-jobs list command:
rd-jobs list --file /tmp/jobs.yaml -F yaml
The YAML document can contain multiple Job definitions, in a sequence:
- # job 1
name: ...
- # job 2
name: ...
Each Job definition is a Map consisting of some required and some optional entries, as listed below.
Each Job definition requires these values:
namethe job name
uuidUnique UUID
descriptionthe job description (can be blank)
projectthe Project name
loglevelthe loglevel to use for the job, the value must be one of:
DEBUGVERBOSEINFOWARNERRsequenceThe workflow sequence definition
A minimal job definition example:
name: job name
description: ''
project: project1
loglevel: INFO
sequence:
- exec: a command
In addition, these optional entries can be present:
groupJob group name
multipleExecutions'true/false': if true, the job can have more than one execution at once.
optionsSet of Options for the Job
scheduleJob schedule
nodefiltersNode filter definition
notificationJob result notifications
Note: The UUID can be set manually (if you are writing the job definition from scratch), or will be assigned at job creation time by the Rundeck server using a random UUID. This string should be as unique as possible if you set it manually.
This identifier is used to uniquely identify jobs when ported between Rundeck instances.
This defines the Workflow options and execution sequence.
Example:
sequence:
keepgoing: true
strategy: node-first
commands:
- exec: ...
- script: ...
args: ...
- scriptfile: ...
args:
- scripturl: ...
args:
- jobref:
name: jobname
group: group
args: args
The sequence has these required entries:
keepgoing"true/false" - whether the sequence should keep going if an error occurs
strategy"node-first" or "step-first". Determines the strategy for executing the sequence across a set of nodes. See the Rundeck User Manual for more info.
commandsThis is a Sequence of: * One or more Command Definitions
Each command in the Sequence can be of these different types:
This Command consists of a single entry:
execThis Command executes the script content specified.
scriptThe script content. It is useful to use the YAML "literal" scalar syntax shown below
argsOptional string defining arguments to pass to the script.
Example:
- script: |-
#!/bin/bash
echo this is a script
echo this is option value: @option.test@
args: arguments passed to the script
This Command executes a script file stored on the server.
scriptfilepath to the script file
argsoptional arguments to the script
Example:
- scriptfile: /path/to/script
args: arguments to script
This Command downloads a script file from a URL and executes it.
scripturlURL to the script file
argsoptional arguments to the script
Example:
- scripturl: http://example.com/path/to/script
args: arguments to script
This Command executes another Rundeck Job.
jobrefmap consisting of these entries:
nameName of the Job
groupGroup of the Job (optional)
argsArguments to pass to the job when executed
Example:
- jobref:
group: test
name: simple job test
args: args for the job
Options for a job can be specified with a map. Each map key is the name of the option, and the content is a map defining the Option.
options:
optname1:
[definition..]
optname2:
[definition..]
An option definition has no required entries, so it could be empty:
myoption: {}
Optional map entries are:
descriptiondescription of the option
valuea default value for the option
valuesA set of possible values for the option. This must be a YAML Sequence of strings.
required"true/false" - whether the option is required or not
enforced"true/false" - whether the option value must be one of the specified possible values
regexA regular expression defining what option values are acceptable
valuesUrlA URL to an endpoint that will return a JSON-formatted set of values for the option.
multivalued"true/false" - whether the option supports multiple input values
delimiterA string used to conjoin multiple input values. (Required if multivalued is "true")
secure"true/false" - whether the option is a secure input option. Not compatible with "multivalued"
Example:
test:
required: true
description: a test option
value: dvalue
regex: ^[abcd]value$
values:
- avalue
- bvalue
- cvalue
multivalued: true
delimiter: ','
The data returned from the valuesUrl can be formatted as a list of values:
["x value","y value"]
or as Name-value list:
[
{name:"X Label", value:"x value"},
{name:"Y Label", value:"y value"},
{name:"A Label", value:"a value"}
]
Define a schedule for repeated execution of the Job. The schedule can be defined as a Crontab formatted string, or as individual components. The individual components support Crontab syntax.
crontab: The crontab string, e.g. "0 30 */6 ? Jan Mon *"Or use a structure of explicit components. All of these are optional, but likely you want to change them:
timea map containing:
secondsseconds value (default: "0")
minuteminutes value (default: "0")
hourhour value (default: "0")
monthMonth value (default: "*")
yearYear value (default "*")
dayofmonthday of month value. (mutually exclusive with weekday)
weekdayMap containing:
daydayofmonth) (default: "*") Numerical values are 1-7 for Sunday-Saturday.Example using crontab string:
schedule:
crontab: '0 30 */6 ? Jan Mon *'
Example using structure:
schedule:
time:
hour: '05'
minute: '01'
seconds: '0'
month: APR,MAR,MAY
year: '*'
weekday:
day: FRI,MON,TUE
Specifies the Nodes to use for the job, and the node-dispatch options. Contains the following entries:
dispatcha Map containing:
keepgoing"true/false" - whether to keepgoing on remaining nodes if a node fails
excludePrecedence"true/false" (default "true") - determines precedence for filters
threadcountNumber of threads to use for parallel dispatch (default "1")
rankAttributeName of the Node attribute to use for ordering the sequence of nodes (default is the node name)
rankOrderOrder direction for node ranking. Either "ascending" or "descending" (default "ascending")
The nodefilters must also contain ONE of include or exclude filter specifiers.
include/excludeA Map containing filter entries:
hostnameHostname filter
nameNode name filter
tagsTags filter. Supports boolean operators AND ("+") and OR (",").
os-nameOS name filter
os-familyOS Family filter
os-archOS Arch filter
os-versionOS Version filter
Example:
nodefilters:
dispatch:
threadcount: 1
keepgoing: false
excludePrecedence: true
rankAttribute: rank
rankOrder: descending
include:
tags: web
name: web-.*
exclude:
os-family: windows
Defines result notification for the job. You can include one or both of onsuccess or onfailure notifications. Each type of notification can include a list of email addresses and/or a list of URLs to use as a webhook.
onsuccess/onfailureA Map containing either or both of:
recipientsA comma-separated list of Email addresses
urlsA comma-separated list of URLs to use as webhooks
Example:
notification:
onfailure:
recipients: tom@example.com,shirley@example.com
onsuccess:
urls: 'http://server/callback?id=${execution.id}&status=${execution.status}&trigger=${notification.trigger}'
rd-jobs (1).
The Rundeck source code and all documentation may be downloaded from https://github.com/dtolabs/rundeck/.