Another rundeck blog post. In the latest post we talked about how to move rundeck from one server to another, and we found out there are quite a lot of files to handle (ssh key files, rundeck's configuration, project definitions, job definitions...). Well, with that info, and with the intention of simplify backup tasks, I've written a shell-script to manage rundeck backups, backup and recovery. You can find it at github: https://github.com/ersiko/rundeck-backup and right here in in the page project
It works plain simple, you just need to backup like this
[root@server ~]# ./rundeck-backup.sh backup rundeck.tar.gz
OK - backup finished successfully using /root/rundeck-backup.tar.gz
If we don't type the file name, the backup will be written with today's data:
[root@server ~]# ./rundeck-backup.sh backup
OK - backup finished successfully using /root/rundeck-backup-20130327.tar.gz
And for the recovery, as easy as:
[root@server ~]# ./rundeck-backup.sh restore
Rundeck service is not running, so jobs can't be restored. Do you want to start rundeck? (y/N) y
Starting rundeckd: [ DONE ]
OK - restore finished successfully using /root/rundeck-backup-20130327.tar.gz
There are also other options, to cover all scenarios I've thought of:
[root@server ~]# ./rundeck-backup.sh -h
rundeck_backup - v1.00
Copyleft (c) 2013 Tomàs Núñez Lirola <tnunez@criptos.com> under GPL License
This script deals with rundeck backup/recovery.
Usage: ./rundeck-backup.sh [OPTIONS...] {backup|restore} [backup_file] | -h --help
Options:
-h | --help
Print detailed help
--exclude-config
Don't backup / restore config files
--exclude-projects
Don't backup / restore project definitions
--exclude-keys
Don't backup / restore ssh key files
--exclude-jobs
Don't backup / restore job definitions
--exclude-hosts
Don't backup / restore .ssh/known_hosts file
--include-logs
Include execution logs in the backup / restore procedure (they are excluded by default)
-c <directory> | --configdir <directory>
Change default rundeck config directory (/etc/rundeck)
-u <user> | --user <user>
Change default rundeck user (rundeck)
-s <service> | --service <service
Change default rundeck service (rundeckd)
-f | --force
Assume 'yes' to all questions
This plugin will backup or restore a rundeck instance, copying files and exporting job definitions with rd-jobs tool.
Examples:
/home/users/scripts/rundeck-backup.sh backup rundeck-201303.tar.gz
/home/users/scripts/rundeck-backup.sh restore --exclude-jobs rundeck-201303.tar.gz
I've done my best (and the best I felt like :P), so there is probably room for improvements. I long for critics and suggestions to improve it!
Thank you for your attention :)