Book Image

Puppet 3: Beginner's Guide

By : John Arundel
Book Image

Puppet 3: Beginner's Guide

By: John Arundel

Overview of this book

<p>Everyone's talking about Puppet, the open-source DevOps technology that lets you automate your server setups and manage websites, databases, and desktops. Puppet can build new servers in seconds, keep your systems constantly up to date, and automate daily maintenance tasks. <br /><br />"Puppet 3 Beginner's Guide" gets you up and running with Puppet straight away, with complete real world examples. Each chapter builds your skills, adding new Puppet features, always with a practical focus. You'll learn everything you need to manage your whole infrastructure with Puppet.<br /><br />"Puppet 3 Beginner’s Guide" takes you from complete beginner to confident Puppet user, through a series of clear, simple examples, with full explanations at every stage.</p> <p>Through a series of worked examples introducing Puppet to a fictional web company, you'll learn how to manage every aspect of your server setup. Switching to Puppet needn't be a big, long-term project; this book will show you how to start by bringing one small part of your systems under Puppet control and, little by little, building to the point where Puppet is managing your whole infrastructure.</p> <p>Presented in an easy-to-read guide to learning Puppet from scratch, this book explains simply and clearly all you need to know to use this essential IT power tool, all the time applying these solutions to real-world scenarios.</p>
Table of Contents (17 chapters)
Puppet 3 Beginner's Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Time for action – installing Nginx


Your mission for today is to use Puppet to install the Nginx web server and deploy a holding page for the cat-pictures.com website. Let's start by recalling what your Puppet directory structure should look like, as shown in the following diagram:

  1. Edit the nodes.pp file so it looks like this:

    node 'demo' {
      package { 'nginx':
        ensure => installed,
      }
    }

    Replace demo with the hostname of the machine you're using.

  2. Run Puppet:

    ubuntu@demo:~/puppet$ sudo puppet apply manifests/site.pp 
    Notice: /Stage[main]//Node[demo]/Package[nginx]/ensure: ensure changed 'purged' to 'present'
    Notice: Finished catalog run in 3.10 seconds
    

What just happened?

Let's look at the preceding code in detail:

node 'demo' {
  ...
}

Remember that the node keyword introduces a node declaration, a list of resources that are to be applied only to node demo.

package { 'nginx':
  ensure => installed,
}

In this case, there is one resource, of type package. As with the file resource we created...