Skip to content

Instantly share code, notes, and snippets.

@arbovm
Created August 31, 2011 08:27
Show Gist options
  • Save arbovm/1183073 to your computer and use it in GitHub Desktop.
Save arbovm/1183073 to your computer and use it in GitHub Desktop.
opscode chef scripts
#!/bin/bash
for dir in `find . -type d -depth 1`; do
# remove ./
bag=`echo $dir | sed 's/^..//'`
knife data bag create $bag;
done
#!/bin/bash
for file in `find environments/development | grep \.json`; do
# dirty regexp to get last dir in path
bag=$(echo $file | sed 's/\([^/]*\).\([^/]*\).\([^/]*\).\([^/]*\).\(.*\)/\4/');
knife data bag from file $bag $file;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment