23 C
Bangalore
December 8, 2018
Untitled

CHEF SOLO – A SAVIOR IN DISGUISE FOR TRYING OUT CHEF COOKBOOKS

cooking-chef

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 https://downloads.chef.io/chefdk for the respective platform.
  • It can also be downloaded using the installation script.
$ sudo curl -s https://omnitruck.chef.io/install.sh | 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]"]
}

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

We are all set !! Now we need a ruby script file that contains the configuration of the cookbook 
path for execution.
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

Related posts

Leave a Reply

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