You are previewing Puppet 3 Beginner's Guide.
O'Reilly logo
Puppet 3 Beginner's Guide

Book Description

With only the most basic programming abilities, this book will teach you how to automate your server setups and manage websites using Puppet. It’s fun too, with practical examples based around a fictional web company.

  • Shows you step-by-step how to install Puppet and start managing your systems with simple examples

  • Every aspect of Puppet is explained in detail so that you really understand what you're doing

  • Gets you up and running immediately, from installation to using Puppet for practical tasks in a matter of minutes

  • Written in a clear, friendly, jargon-free style which doesn't assume any previous knowledge and explains things in practical terms

  • In Detail

    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.

    "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.

    "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.

    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.

    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.

    Table of Contents

    1. Puppet 3 Beginner's Guide
      1. Table of Contents
      2. Puppet 3 Beginner's Guide
      3. Credits
      4. About the Author
      5. About the Reviewers
      6. www.PacktPub.com
        1. Support files, eBooks, discount offers and more
          1. Why Subscribe?
          2. Free Access for Packt account holders
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Time for action – heading
          1. What just happened?
          2. Pop quiz – heading
          3. Have a go hero – heading
        6. Reader feedback
        7. Customer support
          1. Errata
          2. Piracy
          3. Questions
      8. 1. Introduction to Puppet
        1. The problem
          1. Configuration management
          2. A day in the life of a sysadmin
          3. Keeping the configuration synchronized
          4. Repeating changes across many servers
          5. Self-updating documentation
          6. Coping with different platforms
          7. Version control and history
        2. Solving the problem
          1. Reinventing the wheel
          2. A waste of effort
          3. Transferable skills
          4. Configuration management tools
        3. Infrastructure as code
          1. Dawn of the devop
          2. Job satisfaction
          3. The Puppet advantage
            1. Welcome aboard
            2. The Puppet way
            3. Growing your network
            4. Cloud scaling
        4. What is Puppet?
          1. The Puppet language
          2. Resources and attributes
        5. Summary
          1. Configuration management
          2. What Puppet does
          3. The Puppet advantage
          4. Scaling
          5. The Puppet language
      9. 2. First steps with Puppet
        1. What you'll need
        2. Time for action – preparing for Puppet
        3. Time for action – installing Puppet
        4. Your first manifest
          1. How it works
          2. Applying the manifest
          3. What just happened?
          4. Modifying existing files
          5. Exercise
        5. Organizing your manifests
        6. Time for action – creating a directory structure
          1. Creating a nodes.pp file
        7. Time for action – creating a node declaration
          1. What just happened?
        8. Summary
          1. Installing Puppet
          2. Manifests
          3. Nodes
      10. 3. Packages, Files, and Services
        1. Packages
        2. Time for action – installing Nginx
          1. What just happened?
          2. More about packages
            1. Installing specific versions
            2. Removing packages
            3. Updating packages
        3. Modules
        4. Time for action – creating an Nginx module
          1. What just happened?
        5. Time for action – making a "puppet apply" command
        6. Services
        7. Time for action – adding the Nginx service
          1. What just happened?
          2. Requiring resources
          3. More about services
            1. Starting a service at boot time
            2. Services that don't support "status"
            3. Specifying how to start, stop, or restart a service
        8. Files
        9. Time for action – deploying a virtual host
          1. What just happened?
          2. Notifying other resources
          3. The package–file–service pattern
          4. Exercise
        10. Summary
          1. Packages
          2. Modules
          3. Services
            1. Starting services at boot
            2. Service status options
            3. Service control commands
          4. Resource dependencies
          5. Files
      11. 4. Managing Puppet with Git
        1. What is version control?
        2. Time for action – importing your manifests into Git
          1. What just happened?
        3. Time for action – committing and inspecting changes
          1. What just happened?
          2. How often should I commit?
          3. Branching
        4. Distributing Puppet manifests
          1. Reliability
          2. Scalability
          3. Simplicity
        5. Time for action – creating a master Git repo
        6. Time for action – cloning the repo to a new machine
        7. Time for action – adding a new node
        8. Time for action – pushing changes to the master repo
          1. Exercise
          2. Pulling changes automatically
        9. Time for action – automatic pull-and-apply script
          1. What just happened?
        10. Learning more about Git
        11. Summary
          1. Why version control?
          2. Getting started with Git
          3. Networking Puppet
      12. 5. Managing users
        1. Users
          1. Security and access control
          2. What Puppet can do
        2. Time for action – creating a user
          1. What just happened?
          2. Removing user accounts
        3. Access control
          1. What is SSH?
          2. Managing SSH keys
        4. Time for action – adding an SSH authorized key
          1. What just happened?
          2. Generating new SSH keys
          3. Special-purpose keys
          4. Locking user accounts
          5. Managing SSH configuration
        5. Time for action – deploying an SSH configuration file
        6. User privileges
          1. sudo
        7. Time for action – deploying a sudoers file
          1. What just happened?
        8. Summary
          1. Security practices
          2. User resources
            1. Removing or locking accounts
            2. Managing SSH keys
          3. Configuring SSH
          4. Managing privileges with sudo
      13. 6. Tasks and templates
        1. Running commands with exec resources
        2. Time for action – running an arbitrary command
          1. What just happened?
          2. Running commands selectively
          3. Triggering commands
          4. Chaining commands
          5. Command search paths
        3. Scheduled tasks
        4. Time for action – scheduling a backup
          1. What just happened?
          2. More scheduling options
          3. Running jobs at regular intervals
          4. Running a job as a specified user
          5. Exercise
        5. Distributing files
        6. Time for action – using a recursive file resource
          1. What just happened?
        7. Using templates
        8. Time for action – templating an Nginx virtual host
          1. What just happened?
          2. Inline templates
          3. System facts
          4. Doing the math
          5. Putting it all together
        9. Summary
          1. Exec resources
          2. Scheduled jobs
          3. Recursive file resources
          4. Templates
      14. 7. Definitions and Classes
        1. Grouping resources into arrays
        2. Definitions
          1. Passing parameters to definitions
          2. Optional parameters
        3. Time for action – creating a definition for Nginx websites
          1. What just happened?
          2. Multiple instances of definitions
          3. Exercise
        4. Classes
          1. Defining classes
          2. Putting classes inside modules
          3. Declaring classes
          4. What's the difference between a class and a definition?
        5. Time for action – creating an NTP class
          1. What just happened?
        6. Summary
          1. Arrays
          2. Definitions
          3. Classes
      15. 8. Expressions and Logic
        1. Conditionals
          1. If statements
            1. else and elsif
            2. Unless statements
          2. Case statements
            1. The default case
            2. Matching multiple cases
          3. Selectors
        2. Expressions
          1. Comparisons
            1. Equality
            2. Magnitude
            3. Substrings
          2. Boolean operators
            1. Combining Boolean operators
          3. Arithmetic operators
        3. Regular expressions
          1. Operators
          2. Syntax
          3. Conditionals
            1. Capture variables
          4. Substitutions
          5. Node definitions
        4. Arrays and hashes
          1. Grouping resources with arrays
          2. Getting values out of arrays
          3. Hashes
          4. Multilevel hashes
          5. Testing hash keys
        5. Summary
          1. Conditionals
          2. Operators
          3. Regular expressions
          4. Text substitution
          5. Arrays
          6. Hashes
      16. 9. Reporting and troubleshooting
        1. Reporting
          1. Summary reports
          2. Enabling reports
          3. What's in a report?
        2. Time for action – generating a report
          1. What just happened?
          2. Using reports
          3. Debug runs
          4. Noop runs
          5. Syntax checking
        3. Debug output
          1. Notify resources
          2. Exec output
            1. Specifying expected exit status
        4. Monitoring
          1. Managing monitoring with Puppet
          2. What to monitor
          3. Monitoring Puppet status
          4. Problems with Puppet
          5. Staying in sync
        5. Errors
          1. Compilation errors
            1. Diagnosing errors
            2. Missing file sources
            3. Missing parent directory
          2. Mistyped command line options
        6. Summary
          1. Reporting
          2. Debug and dry-run modes
          3. Printing messages
          4. Monitoring Puppet
          5. Common Puppet errors
      17. 10. Moving on Up
        1. Puppet style
          1. Break out code into modules
          2. Refactor common code into definitions
          3. Keep node declarations simple
          4. Use puppet-lint
          5. Make comments superfluous
        2. Puppet learning resources
          1. Reference
            1. Resource types
            2. Language and syntax
            3. Facts
            4. Style
          2. Modules and code
            1. Puppet Forge
            2. The Puppet Cookbook
        3. Projects
          1. Puppet everywhere
          2. User accounts
          3. System toolbox
          4. Time sync
          5. Monitoring server
          6. Puppetize your key services
          7. Automate backups
          8. Set up staging servers
          9. Automate everything
        4. Last word
      18. Index