Leanpub Header

Skip to main content

Ansible DevOps Cookbook, Second Edition

Use ansible-core 2.x to automate, secure and scale linux, windows, containers and multi-cloud infrastructure

Ansible DevOps Cookbook, Second Edition
This book is 100% completeLast updated on 2026-11-21

Our plan is to pull a small publishing platform with web servers, workers, and cloud resources for our practice. While you're doing that, you'll be in charge of execution, managing inventories, and writing your own plugins. Once that's done, you'll package everything into collections and execution environments, test it with Molecule, and secure every Linux, Windows, and Mac host. In the later chapters, the same project moves into containers, Kubernetes, three public clouds, delivery pipelines, event remediation and a governed automation controller. We'll show you the errors we found, like a recursive variable or a library that broke a rulebook, and the fixes.

Minimum price

$29.99

$29.99

You pay

Author earns

$

Also available for 1 book credit with a Reader Membership

PDF
EPUB
1 Previous Editionwith 10 Readers
About

About

About the Book

Designed for engineers looking forward to run and automate real infrastructure with complete scalability

This book is built on Ansible-Core 2.20 and it has got more than 80 practical recipes. It teaches you to control playbook execution, build dynamic inventories, and write your own modules and plugins. Then you get to learn to package your work into signed collections and execution environments, test roles with Molecule, and upgrade safely to Ansible-Core 2.20. And along the way, these tools help you harden your Linux fleets with SSH, SELinux, CIS benchmarks, OpenSCAP, and controlled patching.

What's really cool is that this same project works with Windows and Mac hosts, Docker, Podman, Kubernetes and Helm, and AWS, Azure and GCP alongside Terraform. If you're using Jenkins, GitLab, or GitHub Actions, you can build CI/CD pipelines with OIDC credentials, rolling updates, blue-green releases, and rehearsed rollbacks. With Event-Driven Ansible, you can set it and forget it. The latest versions of AWX and Automation Platform have a bunch of new features, like surveys, team access, workflows, OPA policies, and AI assistants through the MCP server.

Key Learnings
  • Resolve variable precedence conflicts and tune parallelism with linear, free and throttled strategies.
  • Build dynamic, cached cloud inventories and reach private hosts through bastions or SSM.
  • Write custom modules, lookup, filter, inventory and callback plugins for your own platform.
  • Package and sign collections, then run them inside reproducible execution environments.
  • Upgrade to ansible-core 2.20 using ansible-lint, Molecule and multi-version testing.
  • Harden and patch Linux fleets with CIS roles, OpenSCAP scans and controlled reboots.
  • Provision AWS, Azure and GCP resources, and combine Terraform outputs with Ansible configuration.
  • Ship releases through pipelines with OIDC, canary rollouts, blue-green switches and rollbacks.
  • Trigger playbooks from signed webhooks and throttle automatic remediation of Alertmanager alerts.
  • Govern Automation Controller as code with surveys, team roles, OPA policies and MCP.

Table of Content
  1. Controlling Playbook Execution
  2. Managing Inventories
  3. Advanced Playbook Techniques
  4. Ansible Plugins and Modules
  5. Working with Collections and Execution Environments
  6. Upgrading and Testing for ansible-core 2.20
  7. Securing and Patching Linux Systems
  8. Provisioning on Windows and Mac Systems
  9. Automating Containers and Kubernetes
  10. Ansible with AWS, Azure and GCP
  11. Managing CI/CD
  12. Responding to Events with Event-Driven Ansible
  13. Scaling with AWX and Automation Controller

Author

About the Author

GitforGits | Asian Publishing House

We are the engineer’s publisher, the coder’s mentor, and the content alchemist—meticulously turning dense tech into practical gold. With a growing library of 100+ titles, we don’t just develop technical books, rather we build roadmaps for professionals across Python, MySQL, DevOps, Rust, AI, Kotlin, Arduino, Golang and everything around the massive IT ecosystem. Every chapter, every script, every project is a tool in the hands of developers who want to get things done.

Where others summarize, we construct step-by-step learning blueprints, cutting through clutter, banning the fluff, and ensuring every paragraph delivers hands-on value. Our audience isn’t learning from scratch—they’re leveling up with purpose, and we stand by them with code-first content, consistent project workflows, and a zero-redundancy approach.

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub