售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Mastering SaltStack Second Edition
Mastering SaltStack Second Edition
Credits
Foreword
About the Author
About the Reviewer
www.PacktPub.com
Why subscribe?
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. Essentials Revisited
Executing commands remotely
Master and minions
Targeting minions
Glob
Perl Compatible Regular Expression (PCRE)
List
Subnet
Grain
Grain PCRE
Pillar
Compound
Nodegroup
Using module functions
test.ping
test.echo
test.sleep
test.version
pkg.install
pkg.remove
file.replace
Other file functions
Various user and group functions
sys.doc
SLS file trees
SLS files
Tying things together with top files
Organizing the SLS directories
Using states for configuration management
Using include blocks
Ordering with requisites
require
watch
onchanges
onfail
use
prereq
Inverting requisites
Extending SLS files
The basics of grains, pillars, and templates
Using grains for minion-specific data
Centralizing variables with pillars
Managing files dynamically with templates
A quick Jinja primer
Summary
2. Diving into Salt Internals
Understanding the Salt configuration
Following the configuration tree
Looking inside /etc/salt/
Managing Salt keys
Exploring the SLS directories
Examining the Salt cache
The master job cache
The master-side minion cache
The external file server cache
The minion-side proc/ directory
External modules
The renderer
Rendering SLS files
Render pipes
Serving templated files
Understanding the loader
Dynamic modules
Execution modules
Cloud modules
Plunging into the state compiler
Imperative versus declarative
Requisites
High and low states
High states
Low states
Enforcing statefulness
name
result
changes
comment
Summary
3. Managing States
Handling multiple states
Including other SLS files
Spanning multiple environments
Using the base environment
Breaking out environments
Understanding master_tops
Using Salt Stack Formulas on GitHub
Examining the standard layout
formula name
pillar.example
README
LICENSE
FORMULA
Cloning formulas
Using the Salt Package Manager
Thinking of SPM as a package manager
Thinking of SPM as a repository manager
Configuring SPM repositories
Downloading repository metadata
Creating SPM repositories
Set aside a directory to hold packages
Share that directory
Populate the directory
Create the repository metadata
Building packages
version
release
summary
description
name
os
os_family
dependencies
optional
recommended
minimum_version
top_level_dir
license
Where to use SPM
SPM configuration
spm_conf_file
formula_path
pillar_path
reactor_path
spm_logfile
spm_default_include
spm_repos_config
spm_cache_dir
spm_build_dir
spm_build_exclude
spm_db
Summary
4. Exploring Salt SSH
Grappling with SSH
Remote shells
Using rosters
The flat roster
host
port
user
passwd
sudo
priv
timeout
thin_dir
Other built-in rosters
scan
cache
cloud
ansible
Building dynamic rosters
Using Salt SSH
Using a Saltfile
Salt versus Salt SSH
Architecture
Performance
Understanding the salt-thin agent
Building the thin package
Including extra modules
Deploying the thin package
Executing the thin package
The Salt SSH shim
Preparing for Salt states
Running Salt
Salt's running data
Using the raw SSH mode
Caching SSH connections
Summary
5. Managing Tasks Asynchronously
Looking at the event system
Reviewing the basics
The structure of event data
Watching event data
Installing the event listener
Using the event listener
Firing custom data
Namespacing events
Namespacing guidelines
Some common events
salt/auth
salt/key
salt/minion/minion_id/start
salt/job/job_id/new
salt/job/job_id/ret/minion_id
salt/presence/present
salt/presence/change
Common cloud events
salt/cloud/vm_name/creating
salt/cloud/vm_name/requesting
salt/cloud/vm_name/querying
salt/cloud/vm_name/waiting_for_ssh
salt/cloud/vm_name/deploying
salt/cloud/vm_name/created
salt/cloud/vm_name/destroying
salt/cloud/vm_name/destroyed
Salt API events
salt/netapi/url_path
Building reactors
Configuring reactors
Writing reactors
Calling execution modules
Calling runner modules
Calling wheel modules
Writing more complex reactors
Sending out alerts
Using webhooks
Reactors calling reactors
Using Thorium
A word on engines
Looking at Thorium basics
Enabling Thorium
Setting up the Thorium directory tree
Writing Thorium SLS files
Using requisites
Using the register
Looking forward
Using the queue system
Learning how queues work
Adding to the queue
Listing queues
Listing items in a queue
Processing queue items
Deleting items from a queue
Using queues with the reactor
Spreading out State runs
Dividing tasks among minions
Summary
6. Taking Advantage of Salt Information Systems
Understanding pillar_roots
Templating pillar_roots
Calling out to other modules
Using Salt's external pillars
Configuring the etcd pillar
Using git_pillar
Using the mysql pillar
Some final thoughts on external pillars
Using multiple external pillars
Caching pillar data
Understanding SDB
Securely storing passwords
Staying simple
Using SDB URIs
Configuring SDB
Performing SDB lookups
Getting data
Setting data
Deleting data
Comparing pillars and SDB
Where the data is generated
Differences in drivers
Salt Cloud and others
Summary
7. Taking Salt Cloud to the Next Level
Examining the Salt Cloud configuration
Global configurations
Provider and profile configuration
Providers
Profiles
Extending configuration blocks
Using SDB with Salt Cloud
Using SDB with OpenStack
Using SDB with AWS/EC2
Using SDB with other cloud providers
Building custom deploy scripts
Understanding the Salt Bootstrap script
Installing from prebuilt packages
Installing from Git
Looking back at legacy deploy scripts
Writing your own deploy scripts
Passing arguments to scripts
Using file maps
Taking a look at cloud maps
Using reactors with Salt Cloud
Setting up the event tags
Working with autoscale reactors
Cloud cache
Using cloud cache events
Setting up a schedule
Catching cloud cache events
Summary
8. Using Salt with REST
Looking at Salt's HTTP library
Why a Salt-specific library?
Using the http.query function
GET versus POST
Decoding return data
Using the http.query state
Using http.query with reactors
Understanding the Salt API
What is the Salt API?
Setting up the Salt API
CherryPy
Tornado
WSGI
Creating SSL certificates
Configuring authentication
The external authentication module
Taking your first steps with the Salt API
Issuing one-off commands
Working with webhooks
Reacting with Thorium
Security considerations
More complex authentication
Summary
9. Understanding the RAET and TCP Transports
Comparing RAET and ZeroMQ
Starting with HTTP
SSH - the old favorite
Using ZeroMQ
ZeroMQ and security
The need for RAET
Flow-based programming
The pieces of the puzzle
Black boxes
Shared storage
Concurrent scheduling
Driving with RAET
Configuring RAET
The RAET architecture
The basics
The RAET scheduler
Estates and yards
Looking at asynchronous programming
Cooks in a restaurant
Examining the TCP transport
Using the TCP transport
Summary
10. Strategies for Scaling
All about syndication
Different folks, different strokes
No need for micromanaging
Configuring syndication
High availability with multiple masters
Built-in high-availability configuration
Old-school high availability
The round-robin DNS
IP-based load balancing
Synchronizing files
Base configuration files
Synchronizing the nonexternal files
Using rsync
Using the event reactor
Incorporating external data sources
The external job cache
Using returners on the minions
Using the master job cache
External filesystems
GitFS
base
root
mountpoint
user and password
insecure_auth
pubkey, privkey, and passphrase
Other source-control backends
SVNFS
root and mountpoint
trunk
branches
tags
HGFS
S3FS
One environment per bucket
Multiple environments per bucket
AzureFS
External pillars
cmd_yaml/cmd_json
git
redis
mysql
Using the master API
The Salt keys
Configuration
The file and pillar roots
Using the wheel reactor
Using wheel with Thorium
Testing the load in the infrastructure
Using the minionswarm.py script
Swarm internals
Summary
11. Monitoring with Salt
Monitoring basics
Establishing a baseline
Reading the system vitals in Salt
status.loadavg
status.cpustats
status.meminfo
status.vmstats
disk.usage and status.diskusage
status.w
status.all_status and status.custom
Monitoring with returners
Deciding on a returner
Using monitoring states
Defining a monitoring state
Monitoring with web calls
Working with beacons
Monitoring file changes
Beacon intervals
Setting up alerts
Alerting in state files
Alerting from beacons
Watching file changes
Monitoring bad logins
Using aggregate data with Thorium
Summary
12. Exploring Best Practices
Future-proofing your infrastructure
Setting up your directories
Standard directory locations
.sls versus init.sls
Shallow versus deep
Subdividing further
The SLS efficiency
Includes and extends
Using includes
Using extends
Using templates to simplify SLS files
Working with loops
Decisions, decisions
Using the built-in states
Naming conventions
Generic names
Explicit names
Templates and variables
Nested variables
Referring to variables in templates
Summary
13. Troubleshooting Problems
What the...?
Addressing the problem source
Where is the trouble?
Master-to-minion communication
Network and CPU congestion
Checking minion load
Querying the Salt job data
Using debug and trace modes
info
warn
error
debug/trace
Running services in debug mode
Using salt-call locally
Working with YAML
YAML basics
dict
list
YAML idiosyncrasies
Spacing
Numbers
Booleans
List items
Troubleshooting YAML
Asking the community for help
The salt-users mailing list
Asking questions
The Salt issue tracker
Researching before posting
Formatting your issues
Requesting features
#salt on IRC
Final community thoughts
Summary
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜