售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Mastering Ansible
Table of Contents
Mastering Ansible
Credits
About the Author
Acknowledgment
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. System Architecture and Design of Ansible
Ansible version and configuration
Inventory parsing and data sources
The static inventory
Inventory variable data
Dynamic inventories
Run-time inventory additions
Inventory limiting
Playbook parsing
Order of operations
Relative path assumptions
Play behavior keys
Host selection for plays and tasks
Play and task names
Module transport and execution
Module reference
Module arguments
Module transport and execution
Task performance
Variable types and location
Variable types
Accessing external data
Variable precedence
Precedence order
Extra-vars
Connection variables
Most everything else
The rest of the inventory variables
Facts discovered about a system
Role defaults
Merging hashes
Summary
2. Protecting Your Secrets with Ansible
Encrypting data at rest
Things Vault can encrypt
Creating new encrypted files
The password prompt
The password file
The password script
Encrypting existing files
Editing encrypted files
Password rotation for encrypted files
Decrypting encrypted files
Executing ansible-playbook with Vault-encrypted files
Protecting secrets while operating
Secrets transmitted to remote hosts
Secrets logged to remote or local files
Summary
3. Unlocking the Power of Jinja2 Templates
Control structures
Conditionals
Inline conditionals
Loops
Filtering loop items
Loop indexing
Macros
Macro variables
name
arguments
defaults
catch_kwargs
catch_varargs
caller
Data manipulation
Syntax
Useful built-in filters
default
count
random
round
Useful Ansible provided custom filters
Filters related to task status
shuffle
Filters dealing with path names
basename
dirname
expanduser
Base64 encoding
Searching for content
Omitting undefined arguments
Python object methods
String methods
List methods
int and float methods
Comparing values
Comparisons
Logic
Tests
Summary
4. Controlling Task Conditions
Defining a failure
Ignoring errors
Defining an error condition
Defining a change
Special handling of the command family
Suppressing a change
Summary
5. Composing Reusable Ansible Content with Roles
Task, handler, variable, and playbook include concepts
Including tasks
Passing variable values to included tasks
Passing complex data to included tasks
Conditional task includes
Tagging included tasks
Including handlers
Including variables
vars_files
Dynamic vars_files inclusion
include_vars
extra-vars
Including playbooks
Roles
Role structure
Tasks
Handlers
Variables
Modules
Dependencies
Files and templates
Putting it all together
Role dependencies
Role dependency variables
Tags
Role dependency conditionals
Role application
Mixing roles and tasks
Role sharing
Ansible Galaxy
Summary
6. Minimizing Downtime with Rolling Deployments
In-place upgrades
Expanding and contracting
Failing fast
The any_errors_fatal option
The max_fail_percentage option
Forcing handlers
Minimizing disruptions
Delaying a disruption
Running destructive tasks only once
Summary
7. Troubleshooting Ansible
Playbook logging and verbosity
Verbosity
Logging
Variable introspection
Variable sub elements
Subelement versus Python object method
Debugging code execution
Debugging local code
Debugging inventory code
Debugging Playbook code
Debugging runner code
Debugging remote code
Debugging the action plugins
Summary
8. Extending Ansible
Developing modules
The basic module construct
Custom modules
Simple module
Module documentation
Providing fact data
Check mode
Supporting check mode
Handling check mode
Developing plugins
Connection type plugins
Shell plugins
Lookup plugins
Vars plugins
Fact caching plugins
Filter plugins
Callback plugins
Action plugins
Distributing plugins
Developing dynamic inventory plugins
Listing hosts
Listing host variables
Simple inventory plugin
Optimizing script performance
Summary
Index
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜