Skip to content

Instantly share code, notes, and snippets.

@sometimesfood
Last active September 26, 2015 15:17
Show Gist options
  • Save sometimesfood/1117051 to your computer and use it in GitHub Desktop.
Save sometimesfood/1117051 to your computer and use it in GitHub Desktop.
Chef standalone bootstrap with chef-admin-essentials
#!/bin/bash
set -e
export DEBIAN_FRONTEND=noninteractive
sudo apt-get install -qy curl git-core lsb-release chef
mkdir ~/cookbooks
cd ~/cookbooks
echo '*~' > .gitignore
git init
git add .
git commit -am 'Initial commit'
git submodule add git://github.com/sometimesfood/chef-admin-essentials.git admin-essentials
git submodule add git://github.com/sometimesfood/chef-apt-repo apt-repo
git commit -am 'Add chef-admin-essentials'
cat > config.rb <<EOF
cookbook_dir = File.expand_path(File.dirname(__FILE__))
runlist = File.join(cookbook_dir, 'runlist.json')
cookbook_path cookbook_dir
json_attribs runlist
verbose_logging nil
EOF
cat > runlist.json <<EOF
{
"run_list": [
"recipe[admin-essentials]"
]
}
EOF
git add .
git commit -am 'Add standalone config and runlist'
sudo chef-solo -c config.rb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment