售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Puppet 5 Beginner's Guide Third Edition
Table of Contents
Puppet 5 Beginner's Guide Third Edition
Credits
About the Author
Acknowledgments
About the Reviewer
www.PacktPub.com
eBooks, discount offers, and more
Why subscribe?
Customer Feedback
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Getting started with Puppet
Why do we need Puppet anyway?
Keeping the configuration synchronized
Repeating changes across many servers
Self-updating documentation
Version control and history
Why not just write shell scripts?
Why not just use containers?
Why not just use serverless?
Configuration management tools
What is Puppet?
Resources and attributes
Puppet architectures
Getting ready for Puppet
Installing Git and downloading the repo
Installing VirtualBox and Vagrant
Running your Vagrant VM
Troubleshooting Vagrant
Summary
2. Creating your first manifests
Hello, Puppet – your first Puppet manifest
Understanding the code
Modifying existing files
Dry-running Puppet
How Puppet applies the manifest
Creating a file of your own
Managing packages
How Puppet applies the manifest
Exercise
Querying resources with the puppet resource
Services
Getting help on resources with puppet describe
The package-file-service pattern
Notifying a linked resource
Resource ordering with require
Summary
3. Managing your Puppet code with Git
What is version control?
Tracking changes
Sharing code
Creating a Git repo
Making your first commit
How often should I commit?
Branching
Distributing Puppet manifests
Creating a GitHub account and project
Pushing your repo to GitHub
Cloning the repo
Fetching and applying changes automatically
Writing a manifest to set up regular Puppet runs
Applying the run-puppet manifest
The run-puppet script
Testing automatic Puppet runs
Managing multiple nodes
Summary
4. Understanding Puppet resources
Files
The path attribute
Managing whole files
Ownership
Permissions
Directories
Trees of files
Symbolic links
Packages
Uninstalling packages
Installing specific versions
Installing the latest version
Installing Ruby gems
Installing gems in Puppet's context
Using ensure_packages
Services
The hasstatus attribute
The pattern attribute
The hasrestart and restart attributes
Users
Creating users
The user resource
The group resource
Managing SSH keys
Removing users
Cron resources
Attributes of the cron resource
Randomizing cron jobs
Removing cron jobs
Exec resources
Automating manual interaction
Attributes of the exec resource
The user attribute
The onlyif and unless attributes
The refreshonly attribute
The logoutput attribute
The timeout attribute
How not to misuse exec resources
Summary
5. Variables, expressions, and facts
Introducing variables
Using Booleans
Interpolating variables in strings
Creating arrays
Declaring arrays of resources
Understanding hashes
Setting resource attributes from a hash
Introducing expressions
Meeting Puppet's comparison operators
Introducing regular expressions
Using conditional expressions
Making decisions with if statements
Choosing options with case statements
Finding out facts
Using the facts hash
Running the facter command
Accessing hashes of facts
Referencing facts in expressions
Using memory facts
Discovering networking facts
Providing external facts
Creating executable facts
Iterating over arrays
Using the each function
Iterating over hashes
Summary
6. Managing data with Hiera
Why Hiera?
Data needs to be maintained
Settings depend on nodes
Operating systems differ
The Hiera way
Setting up Hiera
Adding Hiera data to your Puppet repo
Troubleshooting Hiera
Querying Hiera
Typed lookups
Types of Hiera data
Single values
Boolean values
Arrays
Hashes
Interpolation in Hiera data
Using lookup()
Using alias()
Using literal()
The hierarchy
Dealing with multiple values
Merge behaviors
Data sources based on facts
What belongs in Hiera?
Creating resources with Hiera data
Building resources from Hiera arrays
Building resources from Hiera hashes
The advantages of managing resources with Hiera data
Managing secret data
Setting up GnuPG
Adding an encrypted Hiera source
Creating an encrypted secret
How Hiera decrypts secrets
Editing or adding encrypted secrets
Distributing the decryption key
Summary
7. Mastering modules
Using Puppet Forge modules
What is the Puppet Forge?
Finding the module you need
Using r10k
Understanding the Puppetfile
Managing dependencies with generate-puppetfile
Using modules in your manifests
Using puppetlabs/mysql
Using puppetlabs/apache
Using puppet/archive
Exploring the standard library
Safely installing packages with ensure_packages
Modifying files in place with file_line
Introducing some other useful functions
The pry debugger
Writing your own modules
Creating a repo for your module
Writing the module code
Creating and validating the module metadata
Tagging your module
Installing your module
Applying your module
More complex modules
Uploading modules to Puppet Forge
Summary
8. Classes, roles, and profiles
Classes
The class keyword
Declaring parameters to classes
Automatic parameter lookup from Hiera data
Parameter data types
Available data types
Content type parameters
Range parameters
Flexible data types
Defined resource types
Type aliases
Managing classes with Hiera
Using include with lookup()
Common and per-node classes
Roles and profiles
Roles
Profiles
Summary
9. Managing files with templates
What are templates?
The dynamic data problem
Puppet template syntax
Using templates in your manifests
Referencing template files
Inline templates
Template tags
Computations in templates
Conditional statements in templates
Iteration in templates
Iterating over Facter data
Iterating over structured facts
Iterating over Hiera data
Working with templates
Passing parameters to templates
Validating template syntax
Rendering templates on the command line
Legacy ERB templates
Summary
10. Controlling containers
Understanding containers
The deployment problem
Options for deployment
Introducing the container
What Docker does for containers
Deployment with Docker
Building Docker containers
The layered filesystem
Managing containers with Puppet
Managing Docker with Puppet
Installing Docker
Running a Docker container
Stopping a container
Running multiple instances of a container
Managing Docker images
Building images from Dockerfiles
Managing Dockerfiles
Building dynamic containers
Configuring containers with templates
Self-configuring containers
Persistent storage for containers
Host-mounted volumes
Docker volumes
Networking and orchestration
Connecting containers
Container orchestration
What is orchestration?
What orchestration tools are available?
Running Puppet inside containers
Are containers mini VMs or single processes?
Configuring containers with Puppet
Containers need Puppet too
Summary
11. Orchestrating cloud resources
Introducing the cloud
Automating cloud provisioning
Using CloudFormation
Using Terraform
Using Puppet
Setting up an Amazon AWS account
Creating an AWS account
Creating an IAM policy
Creating an IAM user
Storing your AWS credentials
Getting ready to use puppetlabs/aws
Creating a key pair
Installing the puppetlabs/aws module
Installing the AWS SDK gem
Creating EC2 instances with Puppet
Choosing an Amazon Machine Image (AMI)
Creating the EC2 instance
Accessing your EC2 instance
VPCs, subnets, and security groups
The ec2_securitygroup resource
The ec2_instance resource
Managing custom VPCs and subnets
Creating an instance in a custom VPC
The ec2_vpc resource
The ec2_vpc_internet_gateway resource
The ec2_vpc_routetable resource
The ec2_vpc_subnet resource
Other AWS resource types
Provisioning AWS resources from Hiera data
Iterating over Hiera data to create resources
Cleaning up unused resources
Summary
12. Putting it all together
Getting the demo repo
Copying the repo
Understanding the demo repo
The control repo
Module management
Classes
Roles
Profiles
Users and access control
SSH configuration
Sudoers configuration
Time zone and clock synchronization
Puppet configuration
The bootstrap process
Adapting the repo for your own use
Configuring users
Adding per-node data files and role classes
Modifying the bootstrap credentials
Bootstrapping a new node
Bootstrapping a Vagrant VM
Bootstrapping physical or cloud nodes
Using other distributions and providers
Summary
The beginning
Index
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜