Start free trial
Trending New Genres Authors
EnglishEnglish
EspañolSpanish
简体中文Chinese
繁體中文Chinese (Traditional)
FrançaisFrench
DeutschGerman
日本語Japanese
PortuguêsPortuguese
ItalianoItalian
한국어Korean
РусскийRussian
NederlandsDutch
العربيةArabic
PolskiPolish
हिन्दीHindi
Tiếng ViệtVietnamese
SvenskaSwedish
ΕλληνικάGreek
TürkçeTurkish
ไทยThai
ČeštinaCzech
RomânăRomanian
MagyarHungarian
УкраїнськаUkrainian
IndonesiaIndonesian
DanskDanish
SuomiFinnish
БългарскиBulgarian
עבריתHebrew
NorskNorwegian
HrvatskiCroatian
CatalàCatalan
SlovenčinaSlovak
LietuviųLithuanian
SlovenščinaSlovenian
СрпскиSerbian
EestiEstonian
LatviešuLatvian
فارسیPersian
മലയാളംMalayalam
தமிழ்Tamil
اردوUrdu
Searching...
SoBrief
Ansible

Ansible

Up and Running: Automating Configuration Management and Deployment the Easy Way
Turn server setup into repeatable, inspectable deployments, from one host to cloud fleets.
by Lorin Hochstein 2014 334 pages
3.88
270 ratings
Listen
Immersive
V2.3
Amazon Kindle Audible
Try Full Access for 3 Days
Unlock listening & more!
Continue

Key Takeaways

Turn server setup into versioned instructions, not a memory test

Capture the real work. The book begins with a familiar failure: a Django application works on a laptop, but deploying it means installing packages, editing web-server settings, and repeating the same steps months later on another machine. Configuration management records those steps as executable instructions, so the deployment process itself becomes a maintained artifact rather than scattered notes and recollection.

Ansible keeps the machinery light. It connects from a control machine to remote Linux or Unix-like hosts over SSH, pushes tasks when an operator runs a playbook, and does not require an Ansible agent on each host. Its YAML instructions use built-in modules for common work such as installing packages, copying files, and managing services. The approach is useful for one test server as well as larger fleets.

Analysis

What's striking is the shift from remembering a procedure to maintaining a system that can perform it. That is a form of institutional memory: a new operator can inspect the same instructions that configure the machine. The design also keeps the control plane small, which lowers adoption costs. But a runnable procedure is more consequential than a README. A mistake in a checked-in instruction can be repeated consistently, so review, version history, and access control become part of operational safety.

Prefer modules that describe the target state over commands that merely run

Reruns should be ordinary. Ansible modules are designed to describe outcomes. A user module can ensure an account exists, while apt can ensure a package is installed. If the host already matches the request, the module reports no change; if it does not, the module corrects it. This property is called idempotence: repeating the operation produces the same intended result as performing it once.

Commands need guardrails. A raw command may report a change every time, or cause damage on a second run. The book recommends using native modules where possible and adding conditions such as a file-exists check when a command must be used. For commands with unreliable status reporting, `changed when` and `failed when` let the playbook define what counts as a real change or failure.

Analysis

Idempotence makes automation recoverable. A rerun after a partial failure can reconcile the machine instead of requiring an operator to reconstruct exactly which steps happened. This resembles retry-safe operations in distributed systems, where networks and processes fail at inconvenient moments. The important limitation is that idempotence is not guaranteed by writing YAML: it depends on module behavior and on accurate descriptions of state. A command wrapped in a task remains a command unless its effects are explicitly bounded.

Model the fleet with groups, environments, and facts, not a flat host list

Inventory is the map. An Ansible inventory names the hosts it can manage and organizes them into groups. A Django service might group machines by environment, such as production and staging, and by function, such as web, database, and task queue. A host can belong to several groups, allowing a playbook to target either a whole environment or a particular service tier.

Keep changing facts out of static lists. Variables can live with a host or group, in separate YAML files, while facts describe information discovered on a machine, including its operating system and network interfaces. Dynamic inventory obtains host data from an external source instead of maintaining a second, potentially stale list. For EC2, the book shows groups formed from tags, so labels such as environment and service type can drive targeting.

Analysis

Inventory is more than a directory of machines. It is a compact model of how a service is organized, and that model determines which changes can be applied safely and selectively. Separating environment from function is especially valuable because those dimensions often change independently. Dynamic inventory reduces duplication, but it also makes the external source of truth operationally important. When group membership comes from tags or cloud data, careless labels can silently widen the scope of a deployment.

Write playbooks as readable runbooks that execute in a deliberate order

A playbook connects hosts to work. It contains one or more plays. Each play selects hosts and lists ordered tasks, and each task invokes a module with arguments. Ansible runs a task across the selected hosts in parallel, waits for that task to finish on those hosts, and then proceeds to the next task. YAML makes this sequence relatively easy to read, while task names explain intent and improve troubleshooting.

Templates centralize configuration. A template combines a text file with variables, allowing one source to generate host-specific configuration, such as an nginx file containing certificate paths or a site name. A handler is a task that runs only when a notifying task reports a change. Handlers are useful for restarting a service after its configuration changes, and run once after the play's ordinary tasks, even if several tasks notify them.

Analysis

The playbook's sequence acts like an explicit operational contract: operators can see both what should happen and in what order. Parallelism across hosts speeds routine work, while the task boundary creates a synchronization point before dependent work begins. Templates also reduce configuration drift by deriving related files from shared variables. Still, readability depends on restraint. A long playbook with hidden variable precedence or indirect control flow can become harder to reason about than the manual procedure it replaced.

Treat production deployment as a chain of services, not a single app install

The Mezzanine example exposes the dependencies. In development, the Django-based content-management application can use SQLite and a built-in web server. Production requires more: PostgreSQL for the database, Gunicorn to run the application, nginx to serve static files and proxy requests, and Supervisor to manage the application process. TLS certificates, system packages, Python libraries, permissions, and configuration files also have to line up.

Ansible makes the chain repeatable. The worked deployment installs operating-system packages, checks out application code from Git, creates a Python virtual environment, installs dependencies, creates a database and user, renders settings from templates, runs database setup commands, and configures services. The example also separates secret credentials from ordinary settings. It illustrates why deployment automation must describe the whole running system, not just copy application code.

Analysis

This example teaches an architectural lesson through practical friction: production behavior emerges from several components whose boundaries matter. The application can be correct while its database credentials, proxy headers, process manager, or static-file paths are wrong. Modeling the deployment forces those dependencies into view. The scope is deliberately concrete, but the same pattern applies only when the surrounding services are understood; automation cannot infer a correct production architecture from the application source alone.

Break growing playbooks into roles with clear responsibilities

Roles package related work. A role groups tasks with any associated handlers, files, templates, variables, defaults, and dependencies. The book separates the Mezzanine deployment into database and application roles. A play then assigns each role to the appropriate hosts, making it easier to deploy the database and web service on separate machines without duplicating their instructions.

Keep reuse practical. Role defaults provide values that a playbook can override, while role variables are intended for values that should be harder to replace. Role dependencies can ensure prerequisite roles run first, and Ansible Galaxy offers a repository of community-contributed roles. The author cautions against assuming generic roles will fit every organization: they are useful building blocks and examples, but local infrastructure often requires locally maintained configuration.

Analysis

Roles resemble modular design in software: they make a large operational task easier to inspect, test, and assign to a service boundary. The strongest benefit is not abstract reuse, but the ability to change one responsibility without editing an undifferentiated script. Shared roles also create a governance question. A role imported from a community repository may encode assumptions about operating systems, security, or filesystem layout, so reuse should mean review and adaptation, not blind adoption.

Limit rollout risk with serial execution, delegation, and explicit failure rules

Choose where and how tasks run. Ansible can run a task on the control machine, delegate it to another host, execute it only once, or process hosts in batches. For a rolling upgrade behind a load balancer, the `serial` setting can limit work to one server at a time. The play can remove that server from traffic, update it, and return it to service before proceeding. `max fail percentage` can stop the rollout when failures exceed a chosen threshold.

Protect sensitive values. The book also covers Ansible Vault, which encrypts files containing items such as database passwords and API credentials. A playbook can read an encrypted file just as it reads a regular variable file, provided the operator supplies its password. These controls do not make a deployment safe by themselves, but they let operators constrain its scope and reduce exposure of secrets.

Analysis

This is where automation becomes a control system rather than a batch script. Serial execution limits simultaneous disruption, delegation lets a deployment coordinate with systems such as a load balancer, and failure thresholds define when the process should stop. These mechanisms make risk visible and configurable. They still rely on a sound recovery plan: taking servers out of rotation one by one is not protection if the health check is misleading or the rollback procedure is absent.

Speed up repeated SSH work, but preserve visibility into what changed

Reduce connection overhead. Ansible uses SSH to communicate with hosts. OpenSSH multiplexing allows several sessions to share a TCP connection, avoiding repeated connection setup. Pipelining can reduce the number of SSH sessions needed for a task, though the remote sudo configuration may need adjustment. Fact caching avoids repeatedly gathering host information, and the `forks` setting controls how many hosts Ansible handles in parallel.

Debug before guessing. The book recommends verbose output for SSH failures, the debug module for inspecting variables, and the assert module for checking assumptions. Syntax checks, host and task listings, check mode, and diffs can help inspect a playbook before applying it. Check mode is useful but imperfect: a task may fail in a dry run because an earlier task would have installed a prerequisite that is not actually present.

Analysis

Performance settings and diagnostic tools solve different problems. Multiplexing and pipelining reduce repeated transport costs, while assertions and diffs improve the operator's understanding of the change. Treating them as one concern can be dangerous: faster execution is not automatically safer execution. Caching also introduces a freshness trade-off, since a cached operating-system fact ages differently from a changing network address. The practical standard is not maximum speed, but a deployment whose runtime and consequences remain legible.

Let cloud metadata drive inventory, and make instance creation idempotent

Cloud hosts are moving targets. The EC2 dynamic inventory script retrieves instances and their attributes directly from Amazon, then groups them by properties such as region, instance type, security group, and tags. Tags can express an organization's own categories, such as production web servers. This avoids maintaining a separate static host list that drifts as instances are added or removed.

Provisioning needs a desired count. A basic EC2 task can launch an instance, but rerunning it may launch another one. The book uses `exact count` with `count tag` to ensure a specified number of matching instances exists. It also shows creating keys and security groups, waiting for instances and SSH to become ready, and adding newly created hosts to the play's inventory. Credentials can be supplied through environment variables or instance IAM roles.

Analysis

Cloud automation combines two kinds of state: the infrastructure provider's record of resources and the configuration tool's view of those resources. Dynamic inventory connects the views, while tags provide a shared vocabulary. Idempotent counts are especially important because a retry should not unexpectedly multiply costs. The design is only as reliable as its identity rules: a count based on a broad tag can select the wrong instances, so tags must be deliberate and consistently maintained.

Use Ansible to coordinate containers, while keeping image building in the build pipeline

Docker separates services into containers. The book's Mezzanine example places PostgreSQL, Memcached, the Django application, nginx, and TLS certificates in separate images or containers. The deployment playbook starts them in dependency order, passes configuration through environment variables, waits for the database to accept connections, links containers that need to communicate, and shares static files through a mounted volume.

Images and running systems are different jobs. Ansible can configure an image by running a playbook inside a base image, and its Docker module can coordinate containers. The book argues that image creation and publication fit naturally into an application build process, while Ansible is especially useful for deployment and orchestration. For custom behavior, a script may suffice; a full module is appropriate when no built-in module expresses the task cleanly.

Analysis

The container example clarifies an important distinction: packaging a service and coordinating live services are related but separate responsibilities. Environment variables keep deployment-specific settings out of a reusable image, while container links and shared volumes make dependencies explicit. The approach also makes startup ordering visible, which is valuable when services are not instantly ready. Container tooling was changing rapidly when the book was written, so its particular module limitations should be read as historical implementation details, not timeless Docker guidance.

Write custom modules only when built-in state management cannot express the job

Start with the smallest suitable tool. Ansible includes modules for common operations, and the book shows a short script as a simpler alternative when a one-off task needs custom logic. A custom module becomes worthwhile when the task is complex, needs meaningful failure handling, or should behave like a reusable Ansible operation. Its result should tell Ansible whether state changed, whether the task failed, and why.

Make the module a good citizen. Python modules can use Ansible's helper class to parse arguments, run external commands, and return structured results. The author recommends supporting check mode, documenting arguments, and testing the module directly. A module that says it changed nothing when it altered the host, or reports success after a failed operation, undermines the clarity that makes Ansible useful.

Analysis

A custom module is an interface commitment, not merely a convenient script. Once other playbooks depend on it, argument validation, predictable output, and check-mode behavior become part of its contract. That investment is justified when the operation recurs or needs reliable semantics; for a single narrow action, a script can be more economical. The distinction mirrors a broader engineering principle: abstraction earns its keep when it reduces repeated complexity without hiding consequential behavior.

Analysis

This is a practical tutorial, not a general theory of operations. Its narrative moves from the author's experience repeating a hand-built Django deployment to a full Mezzanine rollout, then widens outward to roles, performance, cloud provisioning, containers, and custom modules. The ordering matters: readers first learn the smallest useful unit, a task invoking a module, before confronting fleet models and service dependencies. Its central contribution is a way to make operational knowledge both executable and inspectable.

The book's most durable ideas are architectural. Keep the control plane thin, express desired state through modules, organize hosts by meaningful groups, and decompose complex deployments into roles. The Mezzanine case makes those ideas concrete by showing why production requires more than an application server: a database, reverse proxy, process management, static files, credentials, and TLS must work together. The examples also demonstrate that configuration management is a form of systems modeling. A playbook makes assumptions about dependencies, ownership, and readiness explicit, or reveals that they were never understood.

The important caveat is age. The book was tested with Ansible 1.8.4 and its examples use Python 2, historical module names, and syntax that has since changed. Its conceptual lessons remain valuable, but example files should not be copied directly into a current environment without checking present-day Ansible documentation and module behavior. The Docker tooling section itself acknowledges rapid change, and cloud APIs evolve as well. Security guidance also deserves careful application: disabling host-key checks is convenient for disposable test machines, but risky for production connections.

A strong way to use the book today is as a mental model and a debugging guide, not a version-current reference. The core operational question remains: can the intended state be described clearly, applied repeatedly, scoped to the right hosts, and inspected before and after execution? Ansible is most valuable when the answer is yes.

Summary in 30 Seconds
Ansible manages remote Linux hosts over SSH without installing an agent on each one. Modules describe the state a machine should reach, so rerunning a playbook can correct drift without repeating unnecessary changes. Inventories group hosts by environment and purpose; plays and roles organize ordered work across services. Use staged rollouts, checks, and failure rules to limit deployment risk, and keep cloud provisioning and container coordination repeatable. The examples use older Ansible conventions, so verify current syntax before applying them.
Contains spoilers

Last updated:

Report Issue

Review Summary

3.88 out of 5
Average of 270 ratings from Goodreads and Amazon.

Ansible: Up and Running receives generally positive reviews, praised for its comprehensive coverage of Ansible basics and practical examples. Readers appreciate its tutorials on integrating Ansible with AWS, Docker, and Vagrant. The book is recommended for beginners and experienced users alike, offering valuable insights and tips. Some criticisms include outdated content and occasional dry sections. Many reviewers consider it an essential resource for learning Ansible, with clear explanations and useful code samples. Overall, it's viewed as a solid introduction to Ansible automation.

Your rating:
4.37
91 ratings
Want to read the full book?

Glossary

Playbook

Ordered host instructions

A YAML file containing one or more plays. Each play selects a set of hosts and specifies ordered tasks to perform on them. Tasks invoke Ansible modules with arguments, and may also use variables, handlers, and other controls. A playbook is both an operational description and executable automation.

Inventory

Hosts and their groups

The set of hosts Ansible knows how to manage, organized into groups and optionally associated with variables. An inventory can be a static file, a collection of files, or a dynamic source that retrieves host information from another system. Plays use inventory names and patterns to select their targets.

Idempotent

Safe to repeat

An operation is idempotent when running it multiple times has the same intended effect as running it once. Ansible modules commonly check whether a host already matches the requested state and avoid unnecessary changes. This makes reruns safer, although raw commands and poorly designed tasks may need extra conditions to behave idempotently.

Facts

Discovered host information

Facts are variables containing information gathered about a host, such as its operating system, network interfaces, architecture, and memory. Ansible normally gathers them at the start of a play, and playbooks can use them to make configuration decisions. Modules can also return facts, which Ansible makes available as variables.

Handler

Change-triggered task

A handler resembles a task but runs only when another task notifies it after reporting a change. Handlers typically perform actions such as restarting a service after its configuration changes. They run after the ordinary tasks in a play and run only once even when multiple tasks notify the same handler.

Role

Reusable task bundle

A role organizes related tasks and supporting files, templates, handlers, variables, defaults, and dependencies under a named directory structure. Plays assign roles to hosts. Roles help separate responsibilities, such as database setup from web-application deployment, and can be shared or downloaded through Ansible Galaxy.

Dynamic inventory

Live host discovery

A source, commonly an executable script in the book's Ansible version, that supplies hosts, groups, and host variables when Ansible runs. It can query an external system such as a cloud provider, reducing duplication between that system's host records and a manually maintained inventory. Its output may be cached.

Vault

Encrypted variable files

An Ansible mechanism for encrypting files that contain sensitive data, such as passwords or tokens. Playbooks can load encrypted files as variable sources, while the operator supplies a vault password at execution time or through a configured password source. It allows encrypted secrets to be stored alongside automation more safely than plaintext.

Check mode

Change-free preview

A mode for running a playbook that reports whether tasks would change hosts without applying those changes. Modules must support this behavior, and results are not always complete because later tasks may depend on earlier changes that were not actually made. It is useful for review, but should not be treated as a perfect simulation.

SSH multiplexing

Shared SSH connection

An OpenSSH feature that lets multiple SSH sessions to the same host reuse a master TCP connection. Ansible uses it to reduce the overhead of repeatedly establishing connections while running tasks. The connection remains available for a configured period, and a control socket provides the local mechanism for reusing it.

About the Author

Lorin Hochstein is an experienced software engineer and author specializing in DevOps and cloud computing. He has worked for notable companies like Netflix, SendGrid, and Nimbis Services. Hochstein's expertise lies in developing scalable, automated infrastructure solutions. He is known for his practical approach to teaching complex technical concepts, making them accessible to a wide range of readers. In addition to "Ansible: Up and Running," Hochstein has contributed to various technical publications and open-source projects. His work focuses on bridging the gap between development and operations, emphasizing efficiency and reliability in software deployment processes.

Download PDF

To save this Ansible summary for later, download the free PDF. You can print it out, or read offline at your convenience.
Download PDF
File size: 0.36 MB     Pages: 19

Download EPUB

To read this Ansible summary on your e-reader device or app, download the free EPUB. The .epub digital book format is ideal for reading ebooks on phones, tablets, and e-readers.
Download EPUB
File size: 1.41 MB     Pages: 21
Want to read the full book?
Follow
Listen
Home
Swipe
Library
Get App
Try Full Access for 3 Days
Listen, bookmark, and more
Compare Features Free Pro
📖 Read Summaries
Read unlimited summaries. Free users get 3 per month
🎧 Listen to Summaries
Listen to unlimited summaries in 40 languages
—
❤️ Unlimited Bookmarks
Free users are limited to 4
—
📜 Unlimited History
Free users are limited to 4
—
📥 Unlimited Downloads
Free users are limited to 1
—
Risk-Free Timeline
Today: Get Instant Access
Listen to full summaries of 26,000+ books. That's 12,000+ hours of audio!
Day 2: Trial Reminder
We'll send you a notification that your trial is ending soon.
Day 3: Your subscription begins
You'll be charged on Nov 24,
cancel anytime before.
Consume 2.8× More Books
2.8× more books Listening Reading
Our users love us
1M+ readers
Trustpilot Rating
TrustPilot
4.6 Excellent
This site is a total game-changer. I've been flying through book summaries like never before. Highly, highly recommend.
— Dave G
Worth my money and time, and really well made. I've never seen this quality of summaries on other websites. Very helpful!
— Em
Highly recommended!! Fantastic service. Perfect for those that want a little more than a teaser but not all the intricate details of a full audio book.
— Greg M
Save 62%
Yearly
$119.88 $44.99/year/yr
$3.75/mo
Monthly
$9.99/mo
Start a 3-Day Free Trial
3 days free, then $44.99/year. Cancel anytime.
Unlock a world of fiction & nonfiction books
26,000+ books for the price of 2 books
Read any book in 10 minutes
Discover new books like Tinder
Request any book if it's not summarized
Read more books than anyone you know
#1 app for book lovers
Lifelike & immersive summaries
30-day money-back guarantee
Download summaries in EPUBs or PDFs
Cancel anytime in a few clicks

Why one summary?

Scanner
Find a barcode to scan

⭐
⭐
⭐
We have a special gift for you
Open
38% off
DISCOUNT FOR YOU
⭐
⭐
⭐
$79.99
$49.99/year
Only $4.16 per month
Continue
2 taps to start, super easy to cancel
Settings
General
Widget
Loading...