Building on the lessons learned in Planning & Installing Chef, this course will explore creating Chef cookbooks in much greater depth, as well as, using development tools to automate cookbook testing before deploying final code in to production.
Because this course builds on the Planning & Installing Chef course, the viewer will already have a functional Chef lab environment, or at least have the capacity to create one. In that course, we focused on the end result, and the Chef recipes and cookbooks we created in Planning & Installing Chef were purposefully quick and dirty, and did not adhere to any kind of development standards. However, this would not work in the day-to-day life of a Chef administrator, where robust, repeatable code is the critical foundation of reliable infrastructure and application configuration. In order to achieve this, in this course we will develop Chef cookbooks designed to configure pre-existing Windows 2012 R2 Server and Ubuntu Server 14.04 LTS systems with a fully-functional web application with database backend (IIS/SQL and Apache/MySQL respectively). These cookbooks will consist of code we build ourselves, as well as, community cookbooks from the Opscode Marketplace. We will then use Test Kitchen and Vagrant to test our cookbooks in a dynamically-created test environment to make sure they are solid, before uploading the code in to production to be applied against our live servers.
James Bannan is a published author and experienced public speaker based in Melbourne, Australia. He is a Microsoft specialist, with a particular focus on Azure infrastructure architecture, development, and automation.
Course Overview Hi everyone, my name is James Bannan and welcome to my course on Getting Productive with Chef Cookbooks. I am a solutions architect in Syst in Australia and a Microsoft MVP in Cloud and Data Center Management. Chef is at the cutting edge of infrastructure DevOps so being up to speed with code driven configuration management is critical for any IT professional. In this course we're going to build on the planning and installing Chef course by building and deploying Chef Cookbooks in both local test and production Chef environments. Some of the major topics we will cover include writing and deploying Chef Cookbooks, using attributes to refactor Chef recipes, troubleshooting recipes, and testing cookbooks with Test Kitchen. By the end of this course you'll know how to build Chef cookbooks from scratch and and deploy tested, functional code into production. Before beginning this course you should be familiar with Chef Server and the Chef Development Kit. Both of these are covered in the course Planning and Installing Chef. I hope you'll join me on this journey to learn Chef with the getting productive with the Getting Productive with Chef Cookbooks at Pluralsight.
Write a Linux Web Application Cookbook Welcome to Module 2, where we're going to write a web application cookbook for application on a Linux managed node. From a high level, what we're going to do in this module is very similar to what we did in Module 1. We're going to write a number of recipes and cookbooks from our Chef DK administrative workstation, upload them to the Chef Server, and they will in turn be picked up by our managed node, which is running Ubuntu. The cookbooks will prep the server for running as a web server, we'll install my SQL and configure a database with customer sample information, and then we'll tie the whole thing together as a web application. First up, though, let's take the all-nodes cookbook, which we created earlier on in Module 1 and apply it to our Linux node. Here we are connected into our Ubuntu Server via SSH. If we do a Chef client run, we can see that there is currently nothing available in the run list, so no resources are going to be converged. Back over on our administrative workstation, as we did previously, we're going to add the all-nodes role to the run list of the managed Linux node. Note that we're not making any changes to the cookbook. We don't need to go back and make any modifications to allow the cookbook to run on Linux, as well as running on Windows. Once we've added the cookbook to the run list, jump back across to the managed Linux node and rerun the Chef agent. This time, the run list has been updated and the Linux node synchronizes all the necessary cookbooks and applies the changes which are required specifically for Ubuntu. This cookbook is a very good example of Chef functionality, which can be applied cross-platform. And now let's move onto something a little bit more complicated.