Setting up a chef infrastructure can be a nightmare for a beginner who wants to understand chef cookbooks, that problem to an extent is solved by chef-solo that is available as part of Chef Development Kit. We will try running a sample cookbook by using chef-solo in Ubuntu version 16.04.

#Installation of Chef DK

  • Download the binary from for the respective platform.
  • It can also be downloaded using the installation script.
$ sudo curl -s | sudo bash -s -- -Pchefdk 
 #Create directory structure for cookbooks.

$ mkdir -p cookbooks/mychef/recipes $ echo "Create a file inside and call it as default.rb" 
 #Add the below contents in default.rb

puts "My Dear Chef Solo" 
 # Create a new file node.json and add the below contents.

{ "run_list":["recipe[mychef]"] } 
We are all set !! Now we need a ruby script file that contains the configuration of the cookbook 
path for execution.

# Create a new file run_solo.rb and add the following configurations.

file_cache_path "cookbooks/mychef" cookbook_path "cookbooks" json_attribs "cookbooks/node.json" 
 Now we are ready to run our sample cookbook using chef-solo

$chef-solo -c run_solo.rb 
Congratulations !! We have tested the cookbook using chef standalone or solo server thus   
simplying the overall cookbook process. Happy Cheffing !!!
Sabin Jn
More than 10+years of rich experience in Software Configuration Management domain.Focus to help teams in shaping SCM best practices to achieve quality in software deliveries.Expertise as a CI/CD specialist for DEVOPS organisations

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.