Chapter 6. Fundamentals of Managing Servers with Chef and Puppet

In this chapter, we will cover the following recipes:

  • Getting started (notions and tools)
  • Installing the Chef Development kit and Puppet Collections
  • Creating a free hosted server Chef account and a Puppet server
  • Automatically bootstrapping a Chef client and a Puppet agent
  • Installing packages
  • Managing services
  • Managing files, directories, and templates
  • Handling dependencies
  • More dynamic code using notifications
  • Centrally sharing data using a Chef data bag and Hiera with Puppet
  • Creating functional roles
  • Managing external Chef cookbooks and Puppet modules

Introduction

Chef is an open source tool used to automate the configuration of systems and it integrates well with most IaaS such as Amazon Web Services, OpenStack, or Google Cloud. Using Chef, we write infrastructure code in Ruby that describes how every aspect of the system is expected to behave according to a number of conditions, then apply it through various client tools to ensure the defined state is applied.

In this chapter, you'll discover the essentials of managing servers using Chef code with the Chef Development Kit (Chef DK). You'll learn how to bootstrap a working Chef environment on a new server, how to install packages and manage services, how easy it is to generate dynamic configurations through files and templates, create useful functional roles, centrally share data to dynamically generate content, and show how to articulate dependencies between services while helping them notify each other of their state, so the whole deployment chain works in order. We'll also have an introduction on easily managing those dependencies, that will give an insight of how to deal with more complex infrastructures managed by Chef.

To illustrate all those features, throughout the chapter we will build a classic LAMP (Linux, Apache, MySQL, PHP) server on CentOS 7.x, from scratch, 100% automated with Chef. This way, we'll go through all the features while progressively building our end project—a working LAMP server with external dependencies on the latest community MySQL 5.7 release, and more features.

All recipes are based on Chef. However, when possible, we'll try to show how things work similarly with Puppet, Chef's direct alternative.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.150.231