version controlling rundeck jobs

1,471 views
Skip to first unread message

Andrew Steady

unread,
Apr 5, 2013, 12:14:07 PM4/5/13
to rundeck...@googlegroups.com
Hi,

Currently to version control our rundeck jobs we use the following to export jobs:

rd-jobs -p Project -g gname --file gname.xml

Save the xml in our version control system and then use the following to load them in:

rd-jobs load -f gname.xml

There are a few limitations to this approach:

1. I have a script which does the following import/export for each group - if we add a new group, I need to modify my loadall and extractall scripts - not ideal
2. The xml returned by the export job comes in a different order each time so viewing differences in source control is not useful.
3. Loading the jobs in, does not handle deletes - is there a way to remove all jobs in a group?

Perhaps the granularity of my xmls should be a job rather than a group, but I don't want to maintain loadall/extractall scripts with every job name in.

Is there a simpler quicker solution out there?

Cheers,

Andy

Greg Schueler

unread,
Apr 8, 2013, 3:45:51 PM4/8/13
to rundeck...@googlegroups.com
Hi Andrew,

Short answer: there's not really a quicker solution that I've seen.  We have discussed ways to make this better, such as to have Rundeck serialize Job definitions to XML on disk when changed in the GUI (similar to Jenkins), and have some kind of hook that can help manage those files in source control. 

for your item #2, can you file an issue? It would be better if we make the xml output as canonical as possible to assist when doing textual diffs.

It is possible to remove all jobs in a group, you can use "rd-jobs purge" command, which will delete jobs matching a query (e.g. -g "group/path")

If I was starting from scratch i might have a directory structure matching my rundeck groups, and have each job in a single file "name.job.xml".  Then to load all I would do something like "find ./jobs -name "*.job.xml -exec rd-jobs load -f \{\} \;" to load them.  On the export side, I would either use the API or "rd-jobs list" to get the ID and group/name of each job, and export each one to the right filepath.  Renaming/moving jobs would have to be handled manually somewhat.






--
You received this message because you are subscribed to the Google Groups "rundeck-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rundeck-discu...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Andrew Steady

unread,
May 9, 2013, 9:21:54 AM5/9/13
to rundeck...@googlegroups.com
Hi,

I'm implementing this now but find that rd-jobs -g groupname -p projectname returns all jobs that being with projectname. Is there anyway I can get it to an exact match rather than a partial match?

Andy

Greg Schueler

unread,
May 9, 2013, 11:38:36 AM5/9/13
to rundeck...@googlegroups.com
Hi Andrew,

that sounds like a bug, can you file an issue?

thanks,
Greg

kcd

unread,
May 12, 2013, 4:44:53 PM5/12/13
to rundeck...@googlegroups.com
Hi Andrew, Greg

This is a good question. We are planning on having different installations of rundeck on various staging/production systems but with the same jobs. It could be easier if rundeck jobs were file backed.

In terms of #1, this is what I am using for backups. Perhaps it should be extended to one file per job...

#!/bin/bash
rm -Rf /tmp/rundeckjobs/*
mkdir -p /tmp/rundeckjobs
for p in `ls /var/rundeck/projects` ;do rd-jobs list -f /tmp/rundeckjobs/$p-jobs-export$(date +%Y%m%d).xml -p $p ;done;

service rundeckd stop
tar cvpzf /tmp/rundeck-$(date +%Y%m%d).tar.gz /var/lib/rundeck/data /var/lib/rundeck/logs /etc/rundeck/ /tmp/rundeckjobs/*.xml
service rundeckd start

Cheers

k

Andrew Steady

unread,
May 13, 2013, 5:27:37 AM5/13/13
to rundeck...@googlegroups.com
Hi,

Nice thanks for sharing.

Yes - 1 file per job is the target but rather hampered by the issue I mentioned - I've raised a defect for that.

One nice thing about 1 file per job is that you can develop a job in rundeck on a test/dev env and then persist the XML directly from the UI using the "Download job definition file" icon on the job page.

For now I think I will auto-save nightly using a bash script at job group granularity.

Cheers,

Andy


--
You received this message because you are subscribed to a topic in the Google Groups "rundeck-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rundeck-discuss/oAx6CKuZ2dk/unsubscribe?hl=en-US.
To unsubscribe from this group and all its topics, send an email to rundeck-discu...@googlegroups.com.

sh...@aufildujeu.com

unread,
Nov 29, 2013, 10:10:39 AM11/29/13
to rundeck...@googlegroups.com
I noticed that the GUI Export Achive option allow you to save a .jar file containing a folder with all jobs definition in individual .xml files.
It would be an easy way to populate a repository.

I did not found a way to script the archive.jar creation. It's seems to be currently a GUI only option.
Apparently this feature should be present in version 2.x... https://github.com/dtolabs/rundeck/issues/485

Best regards,
Shiva

Alex Harvey

unread,
Jan 28, 2018, 11:08:10 PM1/28/18
to rundeck-discuss
Hi all,

I just wondered if this is still the right/best way to get Rundeck jobs revision controlled?

Thanks,
alex

Greg Schueler

unread,
Jan 29, 2018, 1:19:04 PM1/29/18
to rundeck-discuss
Hi Alex,

Rundeck now has an included Git SCM plugin you can use to manage jobs with a git repo.

--
You received this message because you are subscribed to the Google Groups "rundeck-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rundeck-discu...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages