Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering Ansible

You're reading from   Mastering Ansible Effectively automate configuration management and deployment challenges with Ansible 2.7

Arrow left icon
Product type Paperback
Published in Mar 2019
Publisher Packt
ISBN-13 9781789951547
Length 412 pages
Edition 3rd Edition
Tools
Arrow right icon
Authors (2):
Arrow left icon
Jesse Keating Jesse Keating
Author Profile Icon Jesse Keating
Jesse Keating
James Freeman James Freeman
Author Profile Icon James Freeman
James Freeman
Arrow right icon
View More author details
Toc

Table of Contents (17) Chapters Close

Preface 1. Section 1: Ansible Overview and Fundamentals
2. The System Architecture and Design of Ansible FREE CHAPTER 3. Protecting Your Secrets with Ansible 4. Ansible and Windows - Not Just for Linux 5. Infrastructure Management for Enterprises with AWX 6. Section 2: Writing and Troubleshooting Ansible Playbooks
7. Unlocking the Power of Jinja2 Templates 8. Controlling Task Conditions 9. Composing Reusable Ansible Content with Roles 10. Troubleshooting Ansible 11. Extending Ansible 12. Section 3: Orchestration with Ansible
13. Minimizing Downtime with Rolling Deployments 14. Infrastructure Provisioning 15. Network Automation 16. Other Books You May Enjoy

Serializing single tasks

Certain applications that run multiple copies of a service may not react well to all of those services being restarted at once. Typically, when upgrading this type of application, a serial play is used. However, if the application is of a large enough scale, serializing the entire play may be wildly inefficient. A different approach can be used, which is to serialize only the sensitive tasks (often the handlers to restart services).

To serialize a specific handler task, we can make use of a built-in variable, play_hosts. This variable holds the list of hosts that should be used for a given task as a part of the play. It is kept up to date with hosts that have failed or are unreachable. Using this variable, we can construct a loop to iterate over each host that could potentially run a handler task. Instead of using the item in the module arguments, we&apos...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at ₹800/month. Cancel anytime