Here is my shortcut list for some of the chef commands. Not all of these work in AWS opsworks.

Generating cookbooks named apache
chef generate cookbook cookbooks/apache
 
Generating recipes named server.rb  
chef generate recipe cookbooks/apache/ server
Check syntax of recipe  
chef exec ruby -c cookbooks/apache/recipes/server.rb
Run Recipe locally  
sudo chef-client -z cookbooks/apache/recipes/server.rb  
Running recipe from a cookbook where cookbook is apache and recipe is server.rb  
sudo chef-client -z –runlist “apache::server”
Running recipes from multiple cookbooks.  
sudo chef-client -z –runlist “recipe[apache::server]”
If no recipe is specified like in above case server.rb is specified, default.rb is run.
sudo chef-client -z -r “recipe[apache]”
Running recipe from multiple cookbooks simulataneously  
sudo chef-client -z –runlist “recipe[apache::server],recipe[workstation::resources_manage]”
Remember double colons and no space after comma
  Creating templates(generate a template called motd in workstation cookbook)  
chef generate template cookbooks/workstation/ motd
chef generate template [path/to/cookbook] NAME [options]
Generating recipes named server.rb  
chef generate recipe cookbooks/apache/ server
Generating File  
chef generate file cookbooks/apache/ index.html
Categories: DevopsLinux

0 Comments

What do you think?