Book Image

Puppet 5 Beginner's Guide - Third Edition

By : John Arundel
Book Image

Puppet 5 Beginner's Guide - Third Edition

By: John Arundel

Overview of this book

Puppet 5 Beginner’s Guide, Third Edition gets you up and running with the very latest features of Puppet 5, including Docker containers, Hiera data, and Amazon AWS cloud orchestration. Go from beginner to confident Puppet user with a series of clear, practical examples to help you manage every aspect of your server setup. Whether you’re a developer, a system administrator, or you are simply curious about Puppet, you’ll learn Puppet skills that you can put into practice right away. With practical steps giving you the key concepts you need, this book teaches you how to install packages and config files, create users, set up scheduled jobs, provision cloud instances, build containers, and so much more. Every example in this book deals with something real and practical that you’re likely to need in your work, and you’ll see the complete Puppet code that makes it happen, along with step-by-step instructions for what to type and what output you’ll see. All the examples are available in a GitHub repo for you to download and adapt for your own server setup.
Table of Contents (21 chapters)
Puppet 5 Beginner's Guide Third Edition
Credits
About the Author
Acknowledgments
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface
Index

Getting ready for Puppet


Although Puppet is inherently cross-platform and works with many different operating systems, for the purposes of this book, I'm going to focus on just one operating system, namely the Ubuntu 16.04 LTS distribution of Linux, and the most recent version of Puppet, Puppet 5. However, all the examples in the book should work on any recent operating system or Puppet version with only minor changes.

You will probably find that the best way to read this book is to follow along with the examples using a Linux machine of your own. It doesn't matter whether this is a physical server, desktop or laptop, cloud instance, or a virtual machine. I'm going to use the popular Vagrant software to run a virtual machine on my own computer, and you can do the same. The public GitHub repository for this book contains a Vagrantfile, which you can use to get up and running with Puppet in just a few steps.

Installing Git and downloading the repo

To get a copy of the repo that accompanies this book, follow these steps:

  1. Browse to https://git-scm.com/downloads

  2. Download and install the right version of Git for your operating system.

  3. Run the following command:

    git clone https://github.com/bitfield/puppet-beginners-guide-3.git
    

Installing VirtualBox and Vagrant

If you already have a Linux machine or cloud server you'd like to use for working through the examples, skip this section and move on to the next chapter. If you'd like to use VirtualBox and Vagrant to run a local virtual machine (VM) on your computer to use with the examples, follow these instructions:

  1. Browse to https://www.virtualbox.org/

  2. Download and install the right version of VirtualBox for your operating system

  3. Browse to https://www.vagrantup.com/downloads.html

  4. Select the right version of Vagrant for your operating system: OS X, Windows, and so on

  5. Follow the instructions to install the software

Running your Vagrant VM

Once you have installed Vagrant, you can start the Puppet Beginner's Guide virtual machine:

  1. Run the following commands:

    cd puppet-beginners-guide-3
    scripts/start_vagrant.sh
    

    Vagrant will begin downloading the base box. Once that has booted, it will install Puppet. This may take a while, but once the installation is complete, the virtual machine will be ready to use.

  2. Connect to the VM with the following command:

    vagrant ssh
    
  3. You now have a command-line shell on the VM. Check that Puppet is installed and working by running the following command (you may get a different version number, which is fine):

    puppet --version
    5.2.0
    

    Note

    If you're using Windows, you may need to install the PuTTY software to connect to your VM. There is some helpful advice about using Vagrant on Windows at:

    http://tech.osteel.me/posts/2015/01/25/how-to-use-vagrant-on-windows.html

Troubleshooting Vagrant

If you have any problems running the VM, look for help on the VirtualBox or Vagrant websites. In particular, if you have an older machine, you may see a message like the following:

VT-x/AMD-V hardware acceleration is not available on your system. Your 64-bit guest will fail to detect a 64-bit CPU and will not be able to boot.

Your computer may have a BIOS setting to enable 64-bit hardware virtualization (depending on the manufacturer, the trade name for this is either VT-x or AMD-V). Enabling this feature may fix the problem. If not, you can try the 32-bit version of the Vagrant box instead. Edit the file named Vagrantfile in the Git repository, and comment out the following line with a leading # character:

config.vm.box = "ubuntu/xenial64"

Uncomment the following line by removing the leading # character:

# config.vm.box = "ubuntu/xenial32"

Now re-run the scripts/start_vagrant.sh command.