Extending Puppet - Second Edition
eBook - ePub

Extending Puppet - Second Edition

Alessandro Franceschi, Jaime Soriano Pastor

Share book
  1. 316 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Extending Puppet - Second Edition

Alessandro Franceschi, Jaime Soriano Pastor

Book details
Book preview
Table of contents
Citations

About This Book

Start pulling the strings of your infrastructure with Puppet – learn how to configure, customize, and manage your systems more intelligently

About This Book

  • Explore the wider Puppet ecosystem of useful tools
  • Design and manage your Puppet architecture for optimum performance
  • Write more efficient code that keeps your infrastructure more robust

Who This Book Is For

If you are a Puppet user, this book will help you on different levels. If you a beginner, we summarize the key Puppet components and give you the elements to have a broader vision. For more experienced users, you will be surprised by with topics on designing, implementing, adapting, and deploying Puppet architectures. If you are expert, you will find topics and information that is rarely exposed in other books, giving you an insight into Puppet's future and its usage on alternative devices.

What You Will Learn

  • Learn the principles of Puppet language and ecosystem
  • Extract the features of Hiera and PuppetDB's power usage
  • Explore the different approaches to Puppet architecture design
  • Use Puppet to manage network, cloud, and virtualization devices
  • Manage and test the Puppet code workflow
  • Tweak, hack, and adapt the Puppet extension points
  • Get a run through of the strategies and patterns to introduce Puppet automation
  • Master the art of writing reusable modules

In Detail

Puppet has changed the way we manage our systems, but Puppet itself is changing and evolving, and so are the ways we are using it. To tackle our IT infrastructure challenges and avoid common errors when designing our architectures, an up-to-date, practical, and focused view of the current and future Puppet evolution is what we need. With Puppet, you define the state of your IT infrastructure, and it automatically enforces the desired state.

This book will be your guide to designing and deploying your Puppet architecture. It will help you utilize Puppet to manage your IT infrastructure. Get to grips with Hiera and learn how to install and configure it, before learning best practices for writing reusable and maintainable code. You will also be able to explore the latest features of Puppet 4, before executing, testing, and deploying Puppet across your systems. As you progress, Extending Puppet takes you through higher abstraction modules, along with tips for effective code workflow management.

Finally, you will learn how to develop plugins for Puppet - as well as some useful techniques that can help you to avoid common errors and overcome everyday challenges.

Style and approach

This is a collection of specific information about multiple topics related to Puppet and its ecosystem. Starting from a review of the very basics to more advanced topics, mixing practical advice with important theory and broader perspective, along with implementation details.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Extending Puppet - Second Edition an online PDF/ePUB?
Yes, you can access Extending Puppet - Second Edition by Alessandro Franceschi, Jaime Soriano Pastor in PDF and/or ePUB format, as well as other popular books in Ciencia de la computación & Programación en Ruby. We have over one million books available in our catalogue for you to explore.

Information

Year
2016
ISBN
9781785885686

Extending Puppet Second Edition


Table of Contents

Extending Puppet Second Edition
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Errata
Piracy
Questions
1. Puppet Essentials
The Puppet ecosystem
Why configuration management matters
Puppet components
Installing and configuring Puppet
Puppet in action
Resources
The resource abstraction layer
Nodes
Classes and defines
Class inheritance
Resource defaults
Resource references
Variables, facts, and scopes
System's facts
External facts
User variables in Puppet DSL
Type-checking
User variables in an ENC
User variables in Hiera
Puppet built-in variables
Variables scope
Meta parameters
Managing order and dependencies
Run stages
Reserved names and allowed characters
Conditionals
Comparison operators
Iteration and lambdas
The in operator
Expressions combinations
Exported resources
Virtual resources
Modules
Paths of a module and auto loading
Templates
Restoring files from a filebucket
Summary
2. Managing Puppet Data with Hiera
Installing and configuring Hiera
The hiera.yaml configuration file
Global settings
Backend specific settings
Examples
Working with the command line on a YAML backend
Using Hiera in Puppet
Dealing with hashes in Puppet code
Puppet 3 automatic parameter lookup
Evolving usage patterns for class parameters
Additional Hiera backends
Hiera-file
Encryption plugins
Hiera-gpg
Hiera-eyaml
Hiera-http, hiera-mysql
Using Hiera as an ENC
Summary
3. Introducing PuppetDB
Installation and configuration
Installing PuppetDB
PuppetDB configurations
Init script configuration
Configuration settings
Logging configuration
Configurations on the Puppet Master
Dashboards
PuppetDB performance dashboard
Puppetboard—Querying PuppetDB from the Web
PuppetDB API
Querying PuppetDB (read)
PuppetDB commands (write)
Querying PuppetDB for fun and profit
/facts endpoint
/resources endpoint
/nodes endpoint
/catalogs endpoint
/fact-names endpoint
/metrics endpoint
/reports endpoint
/events endpoint
/event-counts endpoint
/aggregated-event-counts endpoint
/server-time endpoint
/version endpoint
The puppetdbquery module
Query format
Querying from the command line
Querying from Puppet manifests
The PuppetDB Hiera backend
How Puppet code may change in the future
Summary
4. Designing Puppet Architectures
Components of a Puppet architecture
Definition of the classes to include in each node
Definition of the parameters to use for each node
Definition of the configuration files provided to the nodes
Definition of custom resources and classes
The Foreman
Roles and profiles
The data and the code
Sample architectures
The default approach
Basic ENC, logic on site module, Hiera backend
The Foreman and Hiera
Hiera-based setup
Foreman smart variables
Facts-driven truths
Nodeless site.pp
Summary
5. Using and Writing Reusable Modules
Modules layout evolution
Class parameters—from zero to data bindings
Params pattern
Data in modules
Files and class names
The anchor pattern
The parameters dilemma
Naming standards
Reusability patterns
Managing files
Managing configuration hash patterns
Managing multiple configuration files
Managing users and dependencies
Managing installation options
Managing extra resources
Summary
6. Higher Abstraction Modules
The OpenStack example
Component (application) modules
Raising abstraction – the official OpenStack module
Raising abstraction – Puppet Labs OpenStack module
Taking an alternate approach
An approach to reusable stack modules
Tiny Puppet
Summary
7. Puppet Migration Patterns
Examining potential scenarios and approaches
New infrastructures
Existing manually managed infrastructures
Node migration
Node update
Existing automated infrastructures
Patterns for extending Puppet coverage
Raising the bar, step by step
Knowing the territory
Defining priorities
Evaluating solutions
Coding
Applying changes
Things change
Puppet friendly infrastructure
Puppet-friendly software
Summary
8. Code Workflow Management
Write Puppet code
Geppetto
Vim
Git workflows
Code management using Git
Git hooks
Environments and branches
Branch based automatic environments
Simplified developer workdir environments
Code review
Gerrit
Online resources for peer review
Testing Puppet code
Using rspec-puppet
Vagrant
Beaker and beaker-rspec
Deploying Puppet code
Using librarian-puppet for deployments
Deploying code with r10k
Propagating Puppet changes
Puppet continuous integration
Travis
Jenkins
Summary
9. Scaling Puppet Infrastructures
Scaling Puppet
As simple as puppet apply
Default Puppet Master
Puppet Master with Passenger
Installing and configuring Passenger
Puppet Master based on Trapperkeeper
Multi-Master scaling
Managing certificates
Managing SSL termination
Managing code and data
Load balancing alternatives
Masterless Puppet
Configurations and infrastructure optimizations
Traffic compression
Caching
Distributing Puppet run times
File system changes check
Scaling stored configs
Measuring performance
Puppet Metrics
Optimizing code
Testing different Puppet versions
Summary
10. Extending Puppet
Anatomy of a Puppet run, under the hood
Puppet extension alternatives
ENC and Hiera Extendibility
Modules pluginsync
Puppet indirector and its termini
Custom functions
Custom facts
Ruby facts distributed via pluginsync
External facts in facts.d directory
Custom types and providers
Custom report handlers
Custom faces
Summary
11. Beyond the System
Puppet on network equipment
Proxy mode with Puppet device application
Native Puppet on network equipment
Cisco onePK
Juniper and the netdev_stdlib
Puppet for cloud and virtualization
VMware
VM provisioning on vCenter and vSphere
vCenter configuration
vSphere virtual machine management with resource types
Amazon Web Services
Cloud provisioning on AWS
AWS provisioning and configuration with resource types
Managing CloudFormation
Cloud provisioning on Google Compute Engine
Puppet on storage devices
Puppet and Docker
Summary
12. Future Puppet
Changing the serialization format
Direct Puppet
File sync
Other changes
Certificate authority in Clojure
Package management...

Table of contents