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