Skip to content

mdxp/knife-backup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

80 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Knife-Backup

Join the chat at https://gitter.im/mdxp/knife-backup

Knife-Backup is a Knife plugin that can help you backup and restore a chef server. It is based on the great work of Steven Danna and Joshua Timberman on the BackupExport and BackupRestore plugins. Currently knife-backup has support for the following objects:

  • clients
  • users (chef 11 - Open Source)
  • nodes
  • roles
  • environments
  • data bags
  • cookbooks and all their versions.

knife-backup will backup all cookbook versions available on the chef server. Cookbooks are normally available in a repository and should be easy to upload like that, but if you are using various cookbook versions in each environment then it might not be so trivial to find and upload them back to the server; downloading them and having them available to upload like that is simple and clean. If you have too many cookbook versions then you might want to cleanup them first using something like knife-cleanup

Users are a bit tricky, knife-backup can't gather the crypted passwords via the chef server so it's forced to reset them to a random string on restore. Be sure to copy them from the restore output or reset them.

Known limitation: currently it is not possible to overwrite a client object already available on the target server and these will be skipped.

Installation

You will need chef installed and a working knife config; it should work with chef versions newer than 0.10.10

gem install knife-backup

Usage

Currently the available commands are:

knife backup export [component component ...] [-D DIR] [options]
knife backup restore [component component ...] [-D DIR]

#Example:
knife backup export cookbooks roles environments -D ~/my_chef_backup

Optional Switches for export

  • -N, --latest only download the latest version of a cookbook
  • -I, --ignore-permissions ignore any permission errors during export

Optional Switches for restore

  • -I, --ignore-metadata-errors Ignore json metadata errors when restoring cookbooks

For more information on commands:

knife backup SUB-COMMAND --help

Note: you should treat this as beta software; I'm using it with success for my needs and hopefully you will find it useful too.

Todo/Ideas

  • Timestamp for the backup folder
  • Track the failed downloads and report them at the end
  • Find out if there is a way to overwrite a client object.

Development

Pull requests are very welcome! Ideally create a topic branch for every separate change you make. For example:

  1. Fork the repo
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Authors

Created and maintained by Marius Ducea ([email protected])

Based on the original plugins by Steven Danna and Joshua Timberman

License

Apache License, Version 2.0 (see LICENSE)

About

knife plugin to help backup and restore a chef server.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages