Discover / Ansible automation / Reading path

Learn Ansible: The Best IT Automation Books, in Order

@codesherpaBeginner → Expert
7
Books
62
Hours
4
Stages
Not yet rated

This curriculum takes an intermediate learner from solid Ansible fundamentals through advanced automation patterns and production-grade operations. Each stage builds directly on the last — establishing core vocabulary and playbook fluency first, then layering in roles, testing, and real-world infrastructure management, before tackling enterprise-scale and DevOps integration concerns.

1

Ansible Foundations & Core Concepts

Beginner

Establish a firm mental model of how Ansible works — inventory, playbooks, modules, variables, and handlers — so every later concept has a solid base to attach to.

Study plan for this stage

Pace: 4–5 weeks, ~40–50 pages/day (approximately 280–350 pages total across both books)

Key concepts
  • Ansible architecture: control node, managed nodes, and agentless SSH-based communication
  • Inventory structure: hosts, groups, and dynamic inventory sources for organizing infrastructure
  • Playbooks as declarative YAML files: plays, tasks, and execution flow
  • Modules as the building blocks of automation: idempotency and common modules (command, shell, copy, package, service, etc.)
  • Variables and facts: defining, scoping, and using variables across plays and tasks; gathering facts from managed nodes
  • Handlers: triggering conditional actions (like service restarts) only when changes occur
  • Roles: organizing playbooks into reusable, modular structures with tasks, handlers, templates, and files
  • Error handling and control flow: conditionals, loops, and managing task execution order
You should be able to answer
  • How does Ansible differ from agent-based configuration management tools, and why does the agentless SSH model matter?
  • What is the difference between static and dynamic inventory, and when would you use each?
  • Explain the structure of a playbook: what are plays, tasks, and how do they relate to modules?
  • What does idempotency mean in Ansible, and why is it a core design principle?
  • How do variables and facts work in Ansible, and what is the difference between them?
  • When and why would you use handlers instead of running tasks unconditionally?
Practice
  • Set up a local Ansible control node and configure SSH access to at least 2–3 managed nodes (VMs or containers); verify connectivity with ansible all -m ping
  • Create a static inventory file with multiple groups (e.g., webservers, databases) and run ad-hoc commands targeting specific groups
  • Write a multi-play playbook that installs a web server (e.g., Nginx), deploys a simple HTML file, and restarts the service using handlers
  • Build a playbook that gathers facts from managed nodes and uses variables (both user-defined and facts) to customize configuration files with Jinja2 templates
  • Create a role structure for a common task (e.g., user management or firewall configuration) with tasks, handlers, templates, and default variables; use it in a playbook
  • Write a playbook with conditionals (when statements) and loops (with_items or loop) to perform the same task across multiple hosts or configurations with different parameters

Next up: This stage establishes the mental model and hands-on fluency needed to move into intermediate topics like advanced playbook patterns, dynamic inventory management, and Ansible Tower/AWX for enterprise automation.

Ansible for DevOps
Jeff Geerling · 2015 · 466 pp

The single most recommended Ansible book in the community; it covers playbooks, roles, and real server provisioning examples in a hands-on, project-driven style that builds intuition fast. Start here to get productive quickly.

Ansible
Lorin Hochstein · 2014 · 382 pp

O'Reilly's canonical reference goes deeper into Ansible's internals, inventory management, and module ecosystem. Read it second to fill in gaps and solidify vocabulary before moving to advanced patterns.

2

Roles, Reusability & Playbook Design

Intermediate

Master the art of writing clean, reusable, and maintainable Ansible code — roles, Ansible Galaxy, variable precedence, Jinja2 templating, and structured project layouts.

Study plan for this stage

Pace: 4–5 weeks, ~40–50 pages/day (mix of reading and hands-on practice)

Key concepts
  • Ansible roles: directory structure, tasks, handlers, templates, variables, and defaults
  • Role reusability: designing roles for flexibility and portability across projects
  • Ansible Galaxy: discovering, installing, and publishing community roles
  • Variable precedence: understanding the hierarchy of variable scopes and overrides
  • Jinja2 templating: filters, conditionals, loops, and dynamic content generation
  • Playbook design patterns: organizing plays, includes/imports, and code organization
  • Project layout best practices: structuring inventories, group_vars, host_vars, and role dependencies
  • Testing and validation: syntax checking, dry-runs, and role testing strategies
You should be able to answer
  • How would you structure an Ansible role to ensure it is reusable across multiple projects with different configurations?
  • Explain the variable precedence order in Ansible and how you would use it to override defaults in a role.
  • What is the purpose of Ansible Galaxy, and how would you use it to both consume and contribute roles?
  • How do Jinja2 filters and conditionals enhance the flexibility of your playbooks and templates?
  • Design a multi-tier playbook structure (using includes/imports) for a complex infrastructure deployment.
  • When would you use role defaults vs. role vars vs. group_vars, and what are the implications for maintainability?
Practice
  • Create a reusable web server role (Apache/Nginx) with configurable ports, document root, and SSL support; test it across different OS distributions.
  • Build a database role (PostgreSQL or MySQL) with role defaults, handlers for service restart, and Jinja2-templated configuration files.
  • Write a playbook that uses variable precedence to override role defaults at multiple levels (inventory, group_vars, host_vars, extra vars).
  • Search Ansible Galaxy for a community role (e.g., geerlingguy.java), install it, and integrate it into your own playbook; document the dependencies.
  • Design a project layout for a multi-environment infrastructure (dev, staging, prod) with separate inventories, group_vars, and host_vars; demonstrate variable overrides per environment.
  • Create a Jinja2-templated configuration file (e.g., application config, web server config) that uses loops, conditionals, and filters to generate dynamic content based on role variables.

Next up: This stage equips you with the architectural and templating skills to build enterprise-grade, scalable automation; the next stage will focus on advanced topics like error handling, async operations, and orchestration patterns that leverage these reusable building blocks.

Ansible Playbook Essentials
Gourav Shah · 2015 · 168 pp

Focuses specifically on playbook architecture and role design patterns, bridging the gap between 'it works' scripts and production-quality automation code. Builds directly on the vocabulary from Stage 1.

Learning Ansible 2 - Second Edition
Fabio Alessandro Locati · 2016 · 266 pp

Covers advanced playbook features — conditionals, loops, delegation, and error handling — with a strong emphasis on structuring larger projects. Prepares the reader for multi-environment and multi-team scenarios.

3

Network Automation & Configuration Management at Scale

Expert

Extend Ansible beyond Linux servers to network devices and large-scale infrastructure, understanding dynamic inventory, AWX/Ansible Tower, and multi-tier environment management.

Study plan for this stage

Pace: 6–8 weeks, ~40–50 pages/day, with 2–3 hands-on lab days per week

Key concepts
  • Network programmability fundamentals: APIs, REST, NETCONF, YANG, and how they enable automation
  • Python for network automation: libraries like Netmiko, NAPALM, and Paramiko for device interaction
  • Data models and structured configuration: understanding YANG models and intent-based networking
  • Multi-vendor network device management: vendor-agnostic automation patterns across Cisco, Arista, Juniper, etc.
  • Ansible integration with network devices: network modules, network_cli, netconf, and REST API plugins
  • Dynamic inventory and fact gathering at scale: building inventory for heterogeneous network environments
  • Idempotency and state management in network automation: ensuring consistent configuration across devices
  • Orchestration patterns: managing multi-tier dependencies, rollback strategies, and change validation
You should be able to answer
  • What are the key differences between imperative and declarative approaches to network automation, and when should you use each?
  • How do NETCONF and YANG enable vendor-agnostic network automation, and what are their limitations?
  • Explain how Netmiko and NAPALM abstract vendor-specific CLI differences, and when would you choose one over the other?
  • How would you design a dynamic inventory system for a multi-vendor network environment with hundreds of devices?
  • What strategies ensure idempotency when automating network device configurations, and how does this differ from server configuration?
  • How do you structure Ansible playbooks to manage dependencies and rollback scenarios across multiple network tiers?
Practice
  • Build a Python script using Netmiko to connect to 3+ network devices (real or simulated) and retrieve running configurations
  • Create a NAPALM-based script that retrieves and compares facts (interfaces, BGP neighbors, OSPF status) across multiple vendors
  • Write an Ansible playbook using network_cli or netconf modules to configure interfaces, routing, or ACLs on at least 2 different device types
  • Design and implement a dynamic inventory script (Python or Jinja2) that discovers network devices from a source (IPAM, SNMP, API) and groups them by vendor/role
  • Develop an idempotent playbook that validates network state before and after configuration changes, with rollback logic
  • Create a multi-stage orchestration playbook that manages configuration changes across a 3-tier network (core, distribution, access) with dependency ordering

Next up: This stage establishes the foundational patterns and tools for network-scale automation, preparing you to integrate these capabilities into AWX/Ansible Tower, implement role-based access control, and manage complex multi-environment deployments with audit trails and approval workflows.

Network Programmability and Automation
Jason Edelman · 2018 · 584 pp

The definitive book on using Ansible (and Python) for network device automation — routers, switches, and firewalls. Essential for ops teams managing hybrid infrastructure.

4

Production Operations & Enterprise Ansible

Expert

Run Ansible confidently at enterprise scale — using Ansible Tower/AWX for orchestration, secrets management with Vault, performance tuning, and integrating Ansible into full CI/CD pipelines.

Study plan for this stage

Pace: 8–10 weeks, ~40–50 pages/day (accounting for dense technical content, labs, and hands-on practice)

Key concepts
  • Ansible Tower/AWX architecture, installation, and cluster setup for enterprise orchestration
  • Role-based access control (RBAC), organizations, teams, and credential management in Tower/AWX
  • Ansible Vault for secrets management: encryption, decryption, and integration with playbooks and CI/CD
  • Performance tuning: async tasks, parallelism, fact caching, and optimization strategies for large inventories
  • CI/CD pipeline integration: triggering Ansible from Jenkins, GitLab CI, GitHub Actions, and webhook automation
  • Advanced inventory management: dynamic inventories, inventory plugins, and multi-environment orchestration
  • Logging, auditing, and monitoring Ansible at scale using Tower/AWX job templates and event-driven automation
  • Configuration management best practices: idempotency, error handling, and enterprise deployment patterns
You should be able to answer
  • How do you set up and configure Ansible Tower/AWX in a clustered, highly-available environment?
  • What is the difference between organizations, teams, and users in Tower/AWX, and how do you implement role-based access control?
  • How do you use Ansible Vault to encrypt sensitive data, and how do you integrate encrypted variables into CI/CD pipelines?
  • What are the key performance tuning techniques (async, parallelism, fact caching) and when should each be applied?
  • How do you integrate Ansible playbooks into a CI/CD pipeline (Jenkins, GitLab CI, GitHub Actions) and trigger them via webhooks?
  • What are dynamic inventories, and how do you use inventory plugins to manage multi-cloud and multi-environment infrastructure?
Practice
  • Install and configure Ansible Tower/AWX in a test environment; create organizations, teams, and users with appropriate RBAC permissions
  • Create an encrypted Vault file with database credentials and API keys; integrate it into a playbook and verify decryption during execution
  • Build a playbook with async tasks and tuned parallelism settings; benchmark performance improvements on a large inventory (50+ hosts)
  • Set up a dynamic inventory using a cloud provider plugin (AWS, Azure, or GCP); verify that hosts are automatically discovered and grouped
  • Create a Tower/AWX job template with webhook integration; trigger it from a GitHub push event and verify execution logs
  • Design a multi-environment playbook (dev, staging, prod) with separate inventories and variable files; deploy configuration changes across all environments
  • Implement a CI/CD pipeline (using Jenkins or GitLab CI) that runs Ansible playbooks, validates syntax, and deploys to production with approval gates

Next up: This stage equips you with enterprise-grade orchestration, security, and automation capabilities; the next stage will likely focus on advanced topics such as custom module development, Ansible plugin architecture, or specialized domains (Kubernetes, cloud-native automation) where you'll apply these production skills to cutting-edge infrastructure challenges.

Mastering Ansible - Fourth Edition
James Freeman · 2021 · 540 pp

The most comprehensive advanced Ansible title available, covering Tower/AWX, Ansible Vault, custom modules, performance optimization, and complex orchestration patterns. The capstone of this curriculum.

Ansible Configuration Management
Hall, Daniel · 2013 · 92 pp

Focuses on long-term configuration drift prevention, compliance enforcement, and day-2 operational concerns — the real-world challenges that emerge after initial automation is in place.

Discussion

Keep reading

Paths that share books, cover the same subject, or open a related topic.

Shares 1 book

Learn Linux from the command line up

Beginner10books130 hrs5 stages
More on Jenkins and continuous integration

Learn Jenkins: The Best CI/CD Books, in Order

Beginner8books72 hrs4 stages
More on Web application security

Learn Web Application Security: The Best Books, in Order

Beginner7books101 hrs4 stages
More on Cloud security

Learn Cloud Security: The Best Books, in Order

Beginner10books69 hrs5 stages

More on ansible automation