Job definitions in YAML
Reported by Alex-SF | January 14th, 2011 @ 12:03 PM | in Rundeck 1.2
Job definitions should be defined in YAML (rather than XML). It is better for human readability.
Here is a hypothetical job definition that shows a strawman example:
#
# Job: simpleapp/Deploy
name: Deploy
group: simpleapp
description: deploy the simple app
loglevel: INFO
project: examples
options:
catalinahome:
{description: the tomcat install directory,
enforcedvalues: false, required: true,
value: /var/rundeck/simpleapp/apache-tomcat}
sequence:
- exec: step1.sh
- script: !!str |
#!/bin/bash
USAGE="$0 <catalinahome>"
die() { echo "ERROR: $@" ; exit 1 ; }
[ $# = 1 ] || { die "Usage: $0 <catalinahome>" ; }
export CATALINA_HOME=$1
[ -d "$CATALINA_HOME" ] || { die "CATALINA_HOME not found: $CATALINA_HOME" ; }
export CATALINA_BASE=$CATALINA_HOME;
echo "Invoking $CATALINA_HOME/bin/startup.sh"
$CATALINA_HOME/bin/startup.sh;
exit $?
scriptargs: ${option.catalinahome}
- jobref: {group: simpleapp, name: step3, arg: {line: "-paramA valA -paramB ${option.catalinahome"}}
schedule:
time: {hour: "06,07,08", minute: 00}
weekday: {day: "*"}
month: {month: "*"}
nodefilters:
include: {tags: simpleapp}
dispatch: {threadcount: 1, keepgoing: false}
notification:
onfailure: {recipients: test@foo.com}
onsuccess: {recipients: test@foo.com}
Comments and changes to this ticket
-
Greg Schueler January 21st, 2011 @ 04:16 PM
- State changed from new to open
- Assigned user set to Greg Schueler
-
Greg Schueler January 21st, 2011 @ 05:55 PM
Three comments about this format:
First,
schedule: weekday: {day: '*'}
is pretty verbose.schedule: weekday: '*'
seems cleaner. Similar for month.Additionally, users can specify either day-of-week OR day-of-month (crontab), so a day-of-month indicator is needed.
possibly: "weekday" and "day" (for day-of-month)
schedule: time: ... month: ... weekday: '1-5'
and
schedule: time: ... month: ... day: '1,23'
Second point: Workflows have additional properties (keepgoing, strategy), so a simple
sequence: [list]
isn't enough.We could do:
sequence: keepgoing: true strategy: node-first commands: - exec: ... - script: ...
or change the key names a bit, replace sequence with workflow, and commands with sequence:
workflow: keepgoing: true strategy: node-first sequence: - exec: ... - script: ...
Third item: All the workflow items allow some kind of argument string, but they are named inconsistently. "scriptargs" for the exec/script items, and then
arg: line:
for the jobref.Suggest we change them all to be just "args" or "arguments" or something.
FYI: here is a first-pass at the yaml output for a job: https://gist.github.com/790772
-
Deleted User January 21st, 2011 @ 07:38 PM
Yes for second and third item.
For first item: can you just use
crontab: "* * * * *"
so I can cut and paste my crontab time info into a job definition? -
Deleted User January 26th, 2011 @ 05:42 PM
(from [1a74fb3af36794bc58b85f3d2146d2eb287372c6]) Initial jobs yaml format support [#172] https://github.com/dtolabs/rundeck/commit/1a74fb3af36794bc58b85f3d2...
-
Greg Schueler January 26th, 2011 @ 05:58 PM
Notes on format:
for schedule:
schedule: time: ... month: ... weekday: day: '1-4'
or
schedule: time: ... month: ... dayofmonth: day: '1-5'
crontab is supported:
schedule: crontab: * * * * * *
For workflows the format is:
sequence: keepgoing: true strategy: node-first commands: - exec: ... args: ... - script: ... args: ... - scriptfile: ... args: - jobref: name: jobname group: group args: args
For node dispatch parameters:
nodefilters: dispatch: threadcount: 1 keepgoing: true excludePrecedence: true include: tags: ... exclude: tags: ...
-
Deleted User January 27th, 2011 @ 11:15 AM
(from [9287281332a2f9532f92127041bf5c51ad3b7a5a]) Force multiline scalars to literal style. [#172] https://github.com/dtolabs/rundeck/commit/9287281332a2f9532f9212704...
-
Deleted User January 28th, 2011 @ 05:14 PM
(from [2ff2df98b855d4502c16f3ed709d9c6b9cb666e5]) Fix some domain properties, update yaml tests [#172] https://github.com/dtolabs/rundeck/commit/2ff2df98b855d4502c16f3ed7...
-
Greg Schueler January 28th, 2011 @ 05:25 PM
Note, for "exec" workflow items there is no support for "args", that was a mistake.
- exec: ...
-
Deleted User February 25th, 2011 @ 10:09 AM
- Milestone order changed from 14 to 0
(from [c1c60e4118233b4e48698b728d6f2284b3501d0e]) Update job definition download toolbar to allow format selection [#172] https://github.com/dtolabs/rundeck/commit/c1c60e4118233b4e48698b728...
-
Greg Schueler February 25th, 2011 @ 11:14 AM
- State changed from open to resolved
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
(DEPRECATED) Please use github issues for issue tracking at http://github.com/dtolabs/rundeck/issues
People watching this ticket
Referenced by
- 172 Job definitions in YAML (from [1a74fb3af36794bc58b85f3d2146d2eb287372c6]) Initial...
- 172 Job definitions in YAML (from [9287281332a2f9532f92127041bf5c51ad3b7a5a]) Force m...
- 172 Job definitions in YAML (from [2ff2df98b855d4502c16f3ed709d9c6b9cb666e5]) Fix som...
- 187 Document jobs/resources yaml formats The job/resources YAML formats need documentation. ref: #...
- 172 Job definitions in YAML (from [f760e60136f62ad0e6287ed5c3c02730731c3c4b]) Fix mul...
- 172 Job definitions in YAML (from [c1c60e4118233b4e48698b728d6f2284b3501d0e]) Update ...