Install Chef (use wget -O-
instead of curl -L
if you don't have curl installed):
curl -L http://opscode.com/chef/install.sh | sudo bash
Create the directory where the test cookbook will live:
mkdir -p ~/chef-repo/cookbooks/my_thing/recipes/
cd ~/chef-repo
Create a Chef Solo configuration file that can be used by non-privileged users:
echo -e "file_cache_path '${HOME}/.chef/cache'\ncookbook_path '${HOME}/chef-repo/cookbooks'\nchecksum_path '${HOME}/.chef/checksums'" > ~/chef-repo/solo.rb
Create the JSON file that tells Chef what recipe(s) to run:
echo '{"run_list": [ "recipe[my_thing]" ] }' > ~/chef-repo/node.json
Create the default recipe with a simple log resource.
echo 'log "Im running Chef!"' > ~/chef-repo/cookbooks/my_thing/recipes/default.rb
Run chef-solo with the config and JSON files above, and specify a node name:
chef-solo -N guineapig -j node.json -c solo.rb