Book review: Learning Chef

   I am finding myself doing repetitive work once in a while and I've been thinking for a while how to automate the redundant parts of my job. I am familiar with Puppet, Ansible and SaltStack but I never played with Chef before nor Ruby before. I started reading "Learning Chef" and I was surprised to learn that Ruby is the primary language for working with Chef. The other interesting tidbit is that Chef uses Microsoft Powershell for automation on Windows. Onto the review...
   The book is pretty easy to read and is intentionally beginner-friendly. The author right off the bat points out two more professional books for Chef, which I appreciated. Kudos go to the author for following a developer approach, referencing Stack Overflow and Ruby language creator's arguments for better programming practices and argument for scripting language such as Ruby vs. a compiled language like Java for automation.

The 1st chapter is an introduction to automation principles and how Chef came about.

The 2nd chapter walks you through setting up a Chef development environment on Linux, Mac and Windows, step by step. One may think it's a lot of redundant information but keep in mind the target audience.

The 3rd chapter is a brief introduction to Ruby and Chef syntax. As I was reading the last part of the chapter, I realized the true potential of Chef.

The 4th chapter is where it's starting to get interesting. You walk through creating files and deploying them with Chef. As soon as I read the chapter, I was sold! I started getting "light bulb moments" on how to deploy my Java, Python and shell scripts to nodes in a repeatable and controlled fashion.

The 5th chapter introduces you to sand-boxing and previous experience of Vagrant and virtualization will help here. You learn how to deploy your recipes, "instructions" in a sandbox environment to test deployment.

The 6th chapter is where you learn to differentiate between Chef client modes, like solo, local and client modes. You also learn about "ohai" tool, that fetches OS info, as well as how to log messages. This is the first chapter to introduce system administration.

The 7th chapter introduces you to cookbooks and include_recipe statement.

The 8th chapter is all about node attributes and also describes execution precedence, in other words, what takes precedence in order of execution, attribute file, recipe and automatic by ohai tool.

The 9th chapter introduces you to Chef server and I must admit that examples need to be updated. Chef server I presume undergone a name change and I was not able to find the Chef version referenced in the book. After some considerable google-fu and trial and error, I was able to complete the chapter tutorials. Overall, this is the chapter where it finally goes over how to manage a central Chef server and connect nodes to it. If you decide to follow the examples, it is imperative that you complete this tutorial because in chapter ten, the foundation built in this chapter will be used to setup SSL on the slave nodes.

Chapter 10 is broken up into two parts; first part introduces you to chef market place where you can search through multiple recipes shared by the Chef community. The second part builds on chapter ninth' tutorial to setup SSL trust between master and slave.

Chapter 11 covers Chef Zero, which is an in-memory Chef server that you can use to develop recipes.

Chapter 12 is more search functionality.

Chapter 13 is Data Bags and I personally got a lot out of this chapter, this functionality will be pertinent in my work. I enjoyed coverage of encrypted information like passwords the most. It was a bane of mine to manage encryption with homegrown utilities. I see many uses for this going forward. Again I encountered problems with tutorials but as I'm writing this review I am at the end of the tutorials and I find that a lot of my mistakes are from carelessness and I cannot guarantee whether problems were due to my lack of attention or the book. I do however want to mention that some features have changed since the release and some information from commands is in fact different.

Chapter 14 covers roles you can assign to servers, like web servers, database servers.

Chapter 15 covers environments like prod, dev, test, etc. If one should pay attention, it would be this chapter where I personally appreciate that the authors included a full-blown production deployment and a way to manage that vs. development.

Chapter 16 is all about testing, ChefSpec, ServerSpec and FoodCritic. These tools test for specific times in development life cycle and I appreciate the full coverage of scenarios available to users.

Final thoughts

I think the book is beginner friendly but it is easy to get lost in Chef "lingo". I don't think this is my last book on Chef because I still didn't grasp the bulk of it. I noticed that in Appendix A, the author covers Open Source Chef Server and it is basically the same chapter as chapter 9. I realize where I went wrong during my tutorial. I downloaded wrong bits. When I thought I was working with the rpms specific to the chapter, I was actually working with open source Chef server and inadvertently completed the steps in Appendix A.



Comments

Popular posts from this blog

Vista Vulnerability Report mentions Ubuntu 6.06 LTS

Running CockroachDB with Docker Compose and Minio, Part 2

Doing "print screen" on a Mac is a pain in the ass