售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Mastering Chef
Table of Contents
Mastering Chef
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
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Introduction to the Chef Ecosystem
Different modes of running Chef
Terminology used in the world of Chef
The anatomy of a Chef run
A Chef run using chef-client
Step 1 – Building a node object
Step 2 – Authenticate
Step 3 – Synchronization of cookbooks
Step 4 – Loading of cookbooks and convergence
Step 5 – Reporting and exception handling
Using chef-solo
Setting up a work environment
Summary
2. Knife and Its Associated Plugins
Introducing Knife
Managing cookbooks
Creating a new cookbook
Uploading a cookbook to chef-server
Getting the list of all the cookbooks on chef-server
Deleting cookbooks
Downloading a cookbook
Deleting multiple cookbooks
Managing environments
Creating an environment
Deleting an environment
Editing an environment
Listing all environments
Displaying information about an environment
Managing roles
Creating a new role
Deleting a role
Editing a role
Listing all available roles
Displaying information about a role
Managing nodes
Creating a node
Listing all available nodes
Displaying information about a node
Editing a node
Adding stuff to the run_list associated with a node
Deleting stuff from the run_list associated with a node
Deleting a node object
Managing an API client
Creating a new client
Listing all available API clients
Displaying information about a client
Deleting an existing client
Reregistering a client
The search command
Bootstrapping a node
Some useful Knife plugins
The knife-ssh plugin
The knife-ec2 plugin
The knife-azure plugin
The knife-google plugin
The knife-push plugin
Summary
3. Chef and Ruby
Ruby
IRB
Variables and types
Symbols
Basic operations
Arithmetic operators
Comparison operators
Assignment operators
Bitwise operators
Logical operators
The Ruby ternary operator
Ruby range operators
The Ruby defined? operator
Conditional statements and loops
The if statement
The unless statement
The case/when statement
The while loop
The until loop
The for loop
Methods
Blocks
Arrays
Creating an array
Accessing elements of an array
Adding elements to an array
Removing elements from an array
Iterating over an array
Selecting elements of an array
The nondestructive way
The destructive way
Bang methods
Hashes
Creating hashes
Iterating over a hash
Classes and objects
What's an object and a class?
Modules
Summary
4. Controlling Access to Resources
The bootstrap process
Authentication
chef-client
Knife
Custom API calls
Authorization
The Open Source Chef server
Enterprise Chef
Object permissions
Groups
Summary
5. Starting the Journey to the World of Recipes
Resources
Guard attributes
Lazy evaluation of attributes
The package resource
The cookbook_file resource
The directory resource
The file resource
The execute resource
The cron resource
The service resource
The bash resource
The template resource
Helper modules
Inline methods
Inline modules
Library modules
Partial templates
Recipes
Attributes
Types of attributes
Including recipes
The run_list
Recipe DSL methods
The platform method
The platform_family method
The value_for_platform method
The value_for_platform_family method
The attribute method
The resources method
Best practices when writing recipes
Summary
6. Cookbooks and LWRPs
Cookbooks
Authoring a cookbook
Uploading a cookbook to the Chef server
Deleting a cookbook
Testing a cookbook
Cookbook versioning
Operators available for use with versioning
Freezing versions
Maintaining multiple versions of cookbooks
Maximum version control strategy
Branch tracking strategy
Custom resources
Setup
Resource
Provider
Provider DSL
Logging
Summary
7. Roles and Environments
Managing roles
Using Knife
Creating a new role
Editing an existing role
Deleting an existing role
Showing details about an existing role
Listing all roles on the Chef server
Using Ruby DSL
Using a JSON file
Using the Chef API
Using the Chef server WebUI
Managing environments
Using Knife
Creating a new environment
Editing an environment configuration
Deleting an environment
Displaying all the environments configured on the Chef server
Showing details associated with an environment
Comparing cookbook versions across environments
Creating or editing an environment using the configuration specified in a file
Using Ruby DSL
Setting up an environment on a node
Using Knife
Editing the client.rb file on the node
Role and environment attributes
Attribute precedence
Environment run lists
Summary
8. Attributes and Their Uses
Attribute naming
Different types of attributes
Different sources of attributes
The attribute file
Recipes
Roles and environments
Ohai
Attribute precedence
Attribute whitelisting
Summary
9. Ohai and Its Plugin Ecosystem
Running the Ohai binary
Ohai plugins
Custom plugins
Logging in Ohai plugins
Summary
10. Data Bags and Templates
Data bags
Management of a data bag
Creating a data bag
Editing a data bag item
Deleting a data bag item or a data bag
Getting a list of all the data bags set up on the Chef server
Getting a list of items and their properties
Using the data bags in recipes
Encrypted data bags
Templates
Template resources and a template in action
Partial templates
Summary
11. Chef API and Search
Prerequisites for using Chef API
Authentication of requests
Endpoints
/users
GET
POST
/users/NAME
DELETE
GET
POST
PUT
/clients
GET
POST
/clients/NAME
DELETE
GET
PUT
/roles
GET
POST
/roles/NAME
DELETE
GET
PUT
/roles/NAME/environments
GET
/roles/NAME/environments/NAME
GET
/cookbooks
GET
/cookbooks/NAME
GET
/cookbooks/NAME/VERSION
DELETE
GET
PUT
/data
GET
POST
/data/NAME
DELETE
GET
POST
/data/NAME/ITEM
DELETE
GET
PUT
/environments
GET
POST
/environments/NAME
DELETE
GET
PUT
/environments/NAME/cookbooks
GET
/environments/NAME/nodes
GET
/environments/NAME/recipes
GET
/environments/NAME/roles/NAME
Search
/search
GET
/search/INDEX
GET
POST
Patterns
Syntax
Exact matching
Wildcard matching
Range matching
Fuzzy matching
Operators
Using search in recipes
Ridley
Summary
12. Extending Chef
Custom Knife plugins
The skeleton of a Knife plugin
Namespace
Class name
Banner
Dependencies
Requirements
Options
Arguments
The run method
Search inside a custom Knife plugin
knife.rb settings
User interactions
Exception handling
A simple Knife plugin
Distributing plugins using gems
Custom Chef handlers
Summary
13. (Ab)Using Chef
The dynamic server list in Capistrano using Chef
Installing Capistrano
Capistrano style deployments using Chef's "deploy" resource
Phases of deployment
Callbacks
Actions
Attributes
Extending Chef to bootstrap distributed systems
Running jobs from your workstation
Running jobs from within recipes
Test-driven development with Chef
Development without TDD
Development with TDD
Types of tests
What to use where
How do we simulate a real-world scenario?
Tools
Using Chef in a dynamic environment such as the cloud
Summary
Index
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜