售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Extending SaltStack
Table of Contents
Extending SaltStack
Credits
Foreword
About the Author
About the Reviewer
www.PacktPub.com
eBooks, discount offers, and more
Why subscribe?
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
Downloading the color images of this book
Errata
Piracy
Questions
1. Starting with the Basics
Using plugins
Loading modules
Standard modules
Virtual modules
Lazy loading modules
Extending the loader system
Loading modules with Python
Detecting grains
Using other detection methods
Summary
2. Writing Execution Modules
Writing Salt modules
Hidden objects
The __virtual__() function
Formatting your code
Virtual modules
Using the salt.utils library
Cross-calling with the __salt__ dictionary
Getting configuration parameters
Handling imports
Reusing code
Logging messages
Using the __func_alias__ dictionary
Validating data
Formatting strings
The final module
Troubleshooting execution modules
Using salt-call
<function> is not available
Summary
3. Extending Salt Configuration
Setting grains dynamically
Setting some basic grains
(Not) cross-calling execution modules
The final grains module
Creating external pillars
Configuring external pillars
Adding an external pillar
Another external pillar
Troubleshooting grains and pillars
Dynamic grains not showing up
External pillars not showing up
Writing SDB modules
Getting SDB data
Setting SDB data
Using a descriptive docstring
Using more complex configuration
The final SDB module
Using SDB modules
Troubleshooting SDB modules
SDB data not showing up
Summary
4. Wrapping States Around Execution Modules
Forming a state module
Determining state
The __virtual__() function
Setting up defaults
Checking for truth
Checking for test mode
Attempting to configure the resource
Notifying about False
Example: checking an HTTP service
Checking credentials
The first stateful function
Another stateful function
Troubleshooting state modules
Step 1: test for truth
Step 2: test mode
Step 3: applying changes
Testing opposites
Summary
5. Rendering Data
Understanding file formats
Serializing data
Working with templates
Using render pipes
Building a serializing renderer
The basic structure
Building a templating renderer
Templating with Tenjin
Using a templating renderer
Troubleshooting renderers
Summary
6. Handling Return Data
Returning data to external destinations
Returning data to the master
Listening to event data
When returners listen to Minions
Your first returner
Using job caches
The final module
Troubleshooting returners
Testing with salt-call
Testing with the Master running
Testing with runners
Writing outputter modules
Pickling our output
Troubleshooting outputters
Summary
7. Scripting with Runners
Using Salt's local client
Scripting with the local client
Using different targets
Combining jobs to add more logic
The final module
Troubleshooting runners
Working with the salt-master service
Timeout issues
Summary
8. Adding External File Servers
How Salt uses files
Mimicking a filesystem
Looking at each function
Setting up our module
envs()
file_list() and dir_list()
find_file()
serve_file()
update()
file_hash()
The final module
Troubleshooting file servers
Start small
Test on a Minion
Summary
9. Connecting to the Cloud
Understanding cloud components
Looking at the puzzle pieces
Connection mechanism
Listing resources
Creating virtual machines
Managing other resources
Libcloud versus SDK versus direct REST API
Writing a generic cloud module
Checking for required configuration
Using http.query()
A common REST API
GET
POST
PATCH
DELETE
Setting up a _query() function
Getting profile details
Listing images
Listing sizes
Listing locations
Listing nodes
Querying standard node data
Querying full node data
Creating a VM
Destroying VMs
Using actions and functions
Using actions
Using functions
The final cloud module
Troubleshooting cloud modules
Write avail_sizes() or avail_images() first
Use shortcuts
Summary
10. Monitoring with Beacons
Watching for data
Keeping an eye on things
Validating configuration
The beacon() function
Watching for beacons
The final beacon module
Troubleshooting beacons
Summary
11. Extending the Master
Using external authentication
Authenticating credentials
Troubleshooting external authentication
Setting auth parameters
Testing with the salt command
Testing with Salt API
Managing the Master with the wheel modules
Wrapping a wheel around runners
The final wheel module
Troubleshooting wheel modules
Summary
A. Connecting Different Modules
Separating Master and Minion functionality
Working with dunders
Using the event bus
Firing events
B. Contributing Code Upstream
How the community works
Asking questions and reporting issues
Using the mailing list
Using IRC
Using the issue tracker
Using GitHub markdown
Understanding the Salt Style Guide
Using Pylint
Creating pull requests on GitHub
Using other branches
Understanding test errors in pull requests
Index
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜