Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
Title Page
Copyright and Credits
Mastering Ansible Third Edition
About Packt
Why subscribe?
Packt.com
Contributors
About the authors
About the reviewer
Packt is searching for authors like you
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Download the color images
Code in Action
Conventions used
Get in touch
Reviews
Section 1: Ansible Overview and Fundamentals
The System Architecture and Design of Ansible
Technical requirements
Ansible version and configuration
Inventory parsing and data sources
Static inventory
Inventory ordering
Inventory variable data
Dynamic inventories
Runtime inventory additions
Inventory limiting
Playbook parsing
Order of operations
Relative path assumptions
Play behavior directives
Execution strategies
Host selection for plays and tasks
Play and task names
Module transport and execution
Module reference
Module arguments
Module blacklisting
Module transport and execution
Task performance
Variable types and location
Variable types
Magic variables
Accessing external data
Variable precedence
Precedence order
Variable group priority ordering
Merging hashes
Summary
Protecting Your Secrets with Ansible
Technical requirements
Encrypting data at rest
Vault IDs and passwords
Things Vault can encrypt
Creating new encrypted files
Password prompt
Password file
Password script
Encrypting existing files
Editing encrypted files
Password rotation on encrypted files
Decrypting encrypted files
Executing Ansible-playbook with encrypted files
Mixing encrypted data with plain YAML
Protecting secrets while operating
Secrets transmitted to remote hosts
Secrets logged to remote or local files
Summary
Ansible and Windows - Not Just for Linux
Technical requirements
Running Ansible from Windows
Checking your build
Enabling WSL
Installing Linux under WSL
Setting up Windows hosts for Ansible control
System requirements for automation with Ansible
Enabling the WinRM listener
Connecting Ansible to Windows
Handling Windows authentication and encryption
Authentication mechanisms
A note on accounts
Certificate validation
Automating Windows tasks with Ansible
Picking the right module
Installing software
Extending beyond modules
Summary
Infrastructure Management for Enterprises with AWX
Technical requirements
Getting AWX up and running
Integrating AWX with your first playbook
Defining a project
Defining an inventory
Defining credentials
Defining a template
Going beyond the basics
Role-based access control (RBAC)
Organizations
Scheduling
Auditing
Surveys
Workflow templates
Notifications
Summary
Section 2: Writing and Troubleshooting Ansible Playbooks
Unlocking the Power of Jinja2 Templates
Technical requirements
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
Controlling Task Conditions
Technical requirements
Defining a failure
Ignoring errors
Defining an error condition
Defining a change
Special handling of the command family
Suppressing a change
Error recovery
Using the rescue section
Using the always section
Handling unreliable environments
Iterative tasks with loops
Summary
Composing Reusable Ansible Content with Roles
Technical requirements
Task, handler, variable, and playbook inclusion concepts
Including tasks
Passing variable values to included tasks
Passing complex data to included tasks
Conditional task includes
Tagging included tasks
Task includes with loops
Including handlers
Including variables
vars_files
Dynamic vars_files inclusion
include_vars
extra-vars
Including playbooks
Roles
Role structure
Tasks
Handlers
Variables
Modules and plugins
Dependencies
Files and templates
Putting it all together
Role dependencies
Role dependency variables
Tags
Role dependency conditionals
Role application
Mixing roles and tasks
Role includes and imports
Role sharing
Ansible Galaxy
Summary
Troubleshooting Ansible
Technical requirements
Playbook logging and verbosity
Verbosity
Logging
Variable introspection
Variable subelements
Subelements versus Python object method
Debugging code execution
Playbook debugging
Debugging local code
Debugging inventory code
Debugging playbook code
Debugging executor code
Debugging remote code
Debugging the action plugins
Summary
Extending Ansible
Technical requirements
Developing modules
The basic module construct
Custom modules
Example – Simple module
Documenting a module
Providing fact data
The 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
Contributing to the Ansible project
Contribution submissions
The Ansible repository
Executing tests
Unit tests
Integration tests
Code-style tests
Making a pull request
Summary
Section 3: Orchestration with Ansible
Minimizing Downtime with Rolling Deployments
Technical requirements
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
Serializing single tasks
Summary
Infrastructure Provisioning
Technical requirements
Managing cloud infrastructures
Creating servers
Booting virtual servers
Adding to runtime inventory
Using OpenStack inventory sources
Managing a public cloud infrastructure
Interacting with Docker containers
Building images
Building containers without a Dockerfile
Docker inventory
Ansible Container
Using ansible-container init
Using ansible-container build
Using ansible-container run
Summary
Network Automation
Technical requirements
Ansible for network manage ment
Cross-platform support
Configuration portability
Backup, restore, and version control
Automated change requests
Handling multiple device types
Researching your modules
Configuring your modules
Writing your playbooks
Configuring Cumulus Networks switches with Ansible
Defining our inventory
Practical examples
Best practices
Inventory
Gathering facts
Jump hosts
Summary
Other Books You May Enjoy
Leave a review - let other readers know what you think
← Prev
Back
Next →
← Prev
Back
Next →