Book Image

Puppet for Containerization

By : Scott Coulton
Book Image

Puppet for Containerization

By: Scott Coulton

Overview of this book

This book teaches you how to take advantage of the new benefits of containerization systems such as Docker, Kubernetes, Docker Swarm, and Docker UCP, without losing the panoptical power of proper configuration management. You will learn how to integrate your containerized applications and modules with your Puppet workflow. You will also understand how to manage, monitor, and orchestrate hosts to keep deployed containers running seamlessly. With the help of this book, you can efficiently automate and document with containers, as a part of your system. The book will also cover use cases of deploying Puppet within a containerized environment.
Table of Contents (16 chapters)

Coding using resource declarations


In this section, we are going to use our module skeleton to build our first Docker application. We are going to write it using standard Puppet manifests.

But first, why is the first module that we are writing Consul? I chose this application for a few reasons. First, Consul has a lot of awesome features such as service discovery and health checks, and can be used as a key/value store. The second reason is that we will use all the features I just mentioned later in the book. So, it will come in handy when we look at Docker Swarm.

File structures

Let's create two new files, install.pp and params.pp, in the manifests folder. The structure should look as shown in the following screenshot:

Writing our module

Let's start writing our module. We will start with init.pp; this module is not going to be very complex as we are only going to add a few lines of code and some parameters. As you can see in the preceding screenshot, we created three files in the manifests directory...