Skip to content

Instantly share code, notes, and snippets.

@scalp42
Forked from benjaminws/save_databags.sh
Created April 26, 2012 03:30
Show Gist options
  • Save scalp42/2495514 to your computer and use it in GitHub Desktop.
Save scalp42/2495514 to your computer and use it in GitHub Desktop.
save databags to disk
#!/bin/bash
# Get all your data bags, save them to disk
set -e
KNIFE=/usr/bin/knife
SAVE_DIR=~/chef-repo/data_bags
for bag in `$KNIFE data bag list`; do
for item in `$KNIFE data bag show $bag`; do
/bin/mkdir -p $SAVE_DIR/$bag/ &&
$KNIFE data bag show -f json $bag $item > $SAVE_DIR/$bag/$item.json;
done;
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment