Chef Beginner: Tutorial and basic Q's

I’m a beginner in Chef. Had few Q’s and need good tutorials to understand every part of a cookbook.

My main requirement is chef solo as we are as of now not using any chef servers and everything we do is from Local.

  1. Whats the difference between chef solo and chef-client --local-mode? What I understand, they both are same just prev version(before v11) referred them as solo and now local mode?
  2. I need a tutorial that does a basic step by step process of explaining every part of cookbook like recipe, runlists, data bags, environment. Have referred learn.chef.io, but I need something more specific to chef client local mode.
  3. Do we also have a tutorial where a user can run a recipe to install say JAVA from their own central repository and should be chef client local mode.
  1. As of Chef 12.10+ if you run chef-solo you are effectively getting chef-client --local-mode. Prior to this they were not the same, chef-solo was a fundamentally different code path than chef-client. Local mode was introduced so that users could easily transition from chef-solo to chef-client.

  2. There is nothing really specific to chef-client --local-mode as the mechanics of Chef don’t really change. Learn.chef.io is still the best resource for learning about chef and the primitives it offers.

  3. Similar to above there isn’t anything specific to `chef-client --local-mode. There is a Java cookbook on the supermarket that may meet your needs but if the cookbook is highly specific to your environment, then writing your own would make sense.

Chef offers useful primitives in the form of resources so while it can do many things that doesn’t always mean there is a tutorial specifically for your desired needs out of the box. With local-mode or solo you are going to have to deliver the cookbooks to your node via some mechanism and configure the clients to look at them as in a traditional environment this is handled by chef-server. How you do so is up to you but there are projects like knife-zero that help you do this from a workstation.

If you are looking for more realtime answers and advice I encourage you to join our Slack community at http://community-slack.chef.io/

  • cheeseplus
1 Like

Thanks @cheeseplus. That answers most of my doubts.

so what are we supposed to be using now for local testing on a workstation? chef-solo? chef-client -z? chef-client --local-mode?

Typically people are using test-kitchen to test their recipes with integration tests against a local or remote vm/cloud. It uses either chef_solo or chef_zero which right now are effectively the same thing. But to directly answer the question

chef-solo == chef-client -z == chef-client --local-mode

It really doesn’t matter at this point which one you use, -z is just the short option form for --local-mode so those are truly identical.

-cheeseplus

Thanks for the clarification. I can continue using the -z then like I’ve gotten used to doing.