Chef Commands
Useful commands for working with Chef on a workstation or on a node.
Local Checks
Cookbook and Repository Workflow
wget http://github.com/chef-cookbooks/chef-repo/tarball/master -O - | tar xzf - --strip-components=1
knife supermarket download mysql
Running Chef
Common Patterns
execute 'compile' do
cwd '/usr/local/src/node-v#{version}'
command 'make install'
creates '/usr/local/src/node-v#{version}/node'
end
remote_file '/usr/local/src/hi.tar.gz' do
source 'http://example.com/hi.tar.gz'
mode 0644
action :create_if_missing
end
Practical Notes
- Use
knifefor interaction with Chef server and cookbooks. - Use
chef-clienton managed nodes in the normal converged workflow. - Use
chef-soloonly when you intentionally want a standalone setup.