You are previewing Mastering Puppet - Second Edition.
O'Reilly logo
Mastering Puppet - Second Edition

Book Description

Master Puppet for configuration management of your systems in an enterprise deployment

About This Book

  • This book is an advanced guide to using and deploying Puppet 4 in your organization with a special focus on issues faced in larger enterprise deployments

  • From an experienced author, learn to deal with scaling, performance, and multiple developers with the help of real-world examples

  • This is the most up-to-date guide on Puppet, and covers the advanced concepts of Puppet 4

  • Who This Book Is For

    This book is for those who have intermediate knowledge of Puppet and are looking to deploy it in their environment. Some idea how to write simple modules for configuration management with Puppet is a prerequisite for this book.

    What You Will Learn

  • Scale out your Puppet infrastructure using proxying techniques

  • Automate your code promotion workflow using Git and r10k

  • Solve real-world problems using public modules from the Puppet Forge

  • Use Hiera to separate the data of your configuration from the code of your configuration

  • Write your own custom facts in Ruby

  • Extend Puppet with your own custom facts, modules, and types

  • Use exported resources to orchestrate change between machines

  • Debug a puppetserver using Java techniques

  • In Detail

    Puppet is a configuration management system and a language. It was written for and by system administrators to manage large numbers of systems efficiently and prevent configuration drifts.

    Mastering Puppet deals with the issues faced when scaling out Puppet to handle large numbers of nodes. It will show you how to fit Puppet into your enterprise and allow many developers to work on your Puppet code simultaneously. In addition, you will learn to write custom facts and roll your own modules to solve problems. Next, popular options for performing reporting and orchestration tasks will be introduced in this book. Moving over to troubleshooting techniques, which will be very useful. The concepts presented are useful to any size organization.

    By the end of the book, you will know how to deal with problems of scale and exceptions in your code, automate workflows, and support multiple developers working simultaneously.

    Style and approach

    This book is a step-wise guide packed with examples to help you configure complex systems in Puppet.

    Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at If you purchased this book elsewhere, you can visit and register to have the code file.

    Table of Contents

    1. Mastering Puppet Second Edition
      1. Table of Contents
      2. Mastering Puppet Second Edition
      3. Credits
      4. About the Author
      5. About the Reviewer
        1. eBooks, discount offers, and more
          1. Why subscribe?
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      8. 1. Dealing with Load/Scale
        1. Divide and conquer
          1. Certificate signing
          2. Reporting
          3. Storeconfigs
          4. Catalog compilation
          5. puppetserver
          6. Building a Puppet master
            1. Certificates
            2. systemd
            3. Creating a load balancer
              1. Apache proxy
              2. TLS headers
                1. SELinux
              3. Configuring masters
            4. Keeping the code consistent
              1. rsync
              2. NFS
              3. Clustered filesystem
              4. Git
          7. One more split
          8. One last split or maybe a few more
        2. Conquer by dividing
          1. Creating an rpm
            1. Using Puppet resource to configure cron
          2. Creating the yum repository
        3. Summary
      9. 2. Organizing Your Nodes and Data
        1. Getting started
        2. Organizing the nodes with an ENC
          1. A simple example
            1. Hostname strategy
            2. Modified ENC using hostname strategy
          2. LDAP backend
            1. OpenLDAP configuration
        3. Hiera
          1. Configuring Hiera
          2. Using hiera_include
        4. Summary
      10. 3. Git and Environments
        1. Environments
          1. Environments and Hiera
            1. Multiple hierarchies
            2. Single hierarchy for all environments
          2. Directory environments
        2. Git
          1. Why Git?
          2. A simple Git workflow
          3. Git hooks
            1. Using post-receive to set up environments
            2. Puppet-sync
          4. Using Git hooks to play nice with other developers
          5. Not playing nice with others via Git hooks
        3. Git for everyone
        4. Summary
      11. 4. Public Modules
        1. Getting modules
        2. Using GitHub for public modules
          1. Updating the local repository
        3. Modules from the Forge
        4. Using Librarian
        5. Using r10k
        6. Using Puppet-supported modules
          1. concat
          2. inifile
          3. firewall
          4. Logical volume manager
          5. Standard library
        7. Summary
      12. 5. Custom Facts and Modules
        1. Module manifest files
          1. Module files and templates
          2. Naming a module
          3. Creating modules with a Puppet module
            1. Comments in modules
          4. Multiple definitions
        2. Custom facts
          1. Creating custom facts
          2. Creating a custom fact for use in Hiera
        3. CFacter
        4. Summary
      13. 6. Custom Types
        1. Parameterized classes
          1. Data types
        2. Defined types
        3. Types and providers
          1. Creating a new type
        4. Summary
      14. 7. Reporting and Orchestration
        1. Turning on reporting
        2. Store
        3. Logback
        4. Internet relay chat
        5. Foreman
          1. Installing Foreman
          2. Attaching Foreman to Puppet
          3. Using Foreman
        6. Puppet GUIs
        7. mcollective
          1. Installing ActiveMQ
          2. Configuring nodes to use ActiveMQ
          3. Connecting a client to ActiveMQ
          4. Using mcollective
        8. Ansible
        9. Summary
      15. 8. Exported Resources
        1. Configuring PuppetDB – using the Forge module
        2. Manually installing PuppetDB
          1. Installing Puppet and PuppetDB
          2. Installing and configuring PostgreSQL
          3. Configuring puppetdb to use PostgreSQL
          4. Configuring Puppet to use PuppetDB
        3. Exported resource concepts
          1. Declaring exported resources
          2. Collecting exported resources
          3. Simple example – a host entry
        4. Resource tags
        5. Exported SSH keys
          1. sshkey collection for laptops
        6. Putting it all together
        7. Summary
      16. 9. Roles and Profiles
        1. Design pattern
        2. Creating an example CDN role
          1. Creating a sub-CDN role
        3. Dealing with exceptions
        4. Summary
      17. 10. Troubleshooting
        1. Connectivity issues
        2. Catalog failures
          1. Full trace on a catalog compilation
          2. The classes.txt file
        3. Debugging
          1. Personal and bugfix branches
            1. Echo statements
          2. Scope
          3. Profiling and summarizing
        4. Summary
      18. Index