
Mastering Ansible
Effectively automate configuration management and deployment challenges with Ansible 2.7, 3rd Edition
- 412 pages
- English
- ePUB (mobile friendly)
- Available on iOS & Android
Mastering Ansible
Effectively automate configuration management and deployment challenges with Ansible 2.7, 3rd Edition
About this book
Design, develop, and solve real-world automation and orchestration problems by unlocking the automation capabilities of Ansible.
Key Features
- Tackle complex automation challenges with the newly added features in Ansible 2.7
Book Description
Automation is essential for success in the modern world of DevOps. Ansible provides a simple, yet powerful, automation engine for tackling complex automation challenges.
This book will take you on a journey that will help you exploit the latest version's advanced features to help you increase efficiency and accomplish complex orchestrations. This book will help you understand how Ansible 2.7 works at a fundamental level and will also teach you to leverage its advanced capabilities. Throughout this book, you will learn how to encrypt Ansible content at rest and decrypt data at runtime. Next, this book will act as an ideal resource to help you master the advanced features and capabilities required to tackle complex automation challenges. Later, it will walk you through workflows, use cases, orchestrations, troubleshooting, and Ansible extensions. Lastly, you will examine and debug Ansible operations, helping you to understand and resolve issues.
By the end of the book, you will be able to unlock the true power of the Ansible automation engine and tackle complex, real- world actions with ease.
What you will learn
- Gain an in-depth understanding of how Ansible works under the hood
- Fully automate Ansible playbook executions with encrypted data
- Access and manipulate variable data within playbooks
- Use blocks to perform failure recovery or cleanup
- Explore the Playbook debugger and the Ansible Console
- Troubleshoot unexpected behavior effectively
- Work with cloud infrastructure providers and container systems
- Develop custom modules, plugins, and dynamic inventory sources
Who this book is for
This book is for Ansible developers and operators who have an understanding of its core elements and applications but are now looking to enhance their skills in applying automation using Ansible.
Frequently asked questions
- Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
- Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app.
Information
Section 1: Ansible Overview and Fundamentals
The System Architecture and Design of Ansible
- Ansible version and configuration
- Inventory parsing and data sources
- Playbook parsing
- Execution strategies
- Module transport and execution
- Variable types and locations
- Magic variables
- Variable precedence (and interchanging this with variable priority ordering)
Technical requirements
Ansible version and configuration
ansible-playbook --version

- ANSIBLE_CFG: This environment variable is used, provided it is set
- ansible.cfg: This is located in the current directory
- ~/.ansible.cfg: This is located in the user's home directory
- /etc/ansible/ansible.cfg
Inventory parsing and data sources
Static inventory
mastery.example.name
[web] mastery.example.name [dns] backend.example.name [database] backend.example.name [frontend:children] web [backend:children] dns database
Inventory ordering
- inventory: This is the default option, and simply means Ansible proceeds as it always has, processing the hosts in the order specified in the inventory file
- reverse_inventory: This results in the hosts being processed in the reverse of the order specified in the inventory
- sorted: The hosts are processed in alphabetically sorted order by name
- reverse_sorted: The hosts are processed in reverse alphabetically sorted order
- shuffle: The hosts are processed in a random order, with the order being randomized on each run
Inventory variable data
- Host-specific data to use in templates
- Group-specific data to use in task arguments or conditionals
- Behavioral parameters to tune how Ansible interacts with a system
Table of contents
- Title Page
- Copyright and Credits
- About Packt
- Contributors
- Preface
- Section 1: Ansible Overview and Fundamentals
- The System Architecture and Design of Ansible
- Protecting Your Secrets with Ansible
- Ansible and Windows - Not Just for Linux
- Infrastructure Management for Enterprises with AWX
- Section 2: Writing and Troubleshooting Ansible Playbooks
- Unlocking the Power of Jinja2 Templates
- Controlling Task Conditions
- Composing Reusable Ansible Content with Roles
- Troubleshooting Ansible
- Extending Ansible
- Section 3: Orchestration with Ansible
- Minimizing Downtime with Rolling Deployments
- Infrastructure Provisioning
- Network Automation
- Other Books You May Enjoy