-
-
Save clavery-chef/a005281206bdc962f79bab61307027a9 to your computer and use it in GitHub Desktop.
knife-ec-backup examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
# Customize all these values | |
# youre source/destination keys and | |
# configs will differ | |
BACKUPDIR="backups" | |
BACKUPLOG="./migration_backup.log" | |
RESTORELOG="./migration_restore.log" | |
SRCWEBUIKEY="conf/src_webui_priv.pem" | |
DSTWEBUIKEY="conf/dst_webui_priv.pem" | |
SRCKNIFERB="conf/src_knife.rb" | |
DSTKNIFERB="conf/dst_knife.rb" | |
BACKUPCONCURRENCY=50 | |
function runbackup () { | |
echo "-- BACKUP STARTING --" >> ${BACKUPLOG} | |
knife ec backup ${BACKUPDIR} --webui-key ${SRCWEBUIKEY} -c ${SRCKNIFERB} --purge --concurrency ${BACKUPCONCURRENCY} 2>&1 | while IFS= read -r line; do echo "$(date) $line"; done >> ${BACKUPLOG} | |
echo "-- BACKUP FINISHED --" >> ${BACKUPLOG} | |
} | |
function runrestore () { | |
echo "-- RESTORE STARTING --" >> ${RESTORELOG} | |
knife ec restore ${BACKUPDIR} --webui-key ${DSTWEBUIKEY} -c ${DSTKNIFERB} --purge 2>&1 | while IFS= read -r line; do echo "$(date) $line"; done >> ${RESTORELOG} | |
echo "-- RESTORE FINISHED --" >> ${RESTORELOG} | |
} | |
case $1 in | |
'backup' ) | |
runbackup ;; | |
'restore' ) | |
runrestore ;; | |
* ) | |
echo "Usage: $0 backup|restore" | |
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
current_dir = File.dirname(__FILE__) | |
log_level :info | |
log_location STDOUT | |
chef_server_url "https://chef-server.test/organizations/acmeinc" | |
ssl_verify_mode :verify_none | |
versioned_cookbooks true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment