Pcornel
Automation · Ansible

Serial Execution

Cheat sheet · https://pcornel.dk/topic.php?topic=5416

Back to the Topic

Answer

Ansible serial execution limits a play to batches of hosts, allowing staged changes and validation while later batches wait for earlier batch progression.

Remember

  • serial: 1 ≠ transactional rollout; each host can still be left changed before a later failure.
  • Batch completed ≠ service capacity healthy; external load/cluster checks may be required.
  • Inventory order ≠ desired maintenance order unless explicitly controlled.
  • Handler execution timing ≠ necessarily after entire fleet; batch/play semantics affect when actions occur.

First checks

  • serial: 1 / '25%' — batches
  • max_fail_percentage — stop rollout
  • ansible-playbook rolling.yml --check — preview

Verify in this order

batch 1 → health check → batch 2 …

Where it usually breaks

A serial batch completing proves that batch ran; it does not provide rollback or prove fleet/service health unless explicit checks verify those properties.

Inventory/vars → play/task selection → connection/become → module request → module result → target object read-back → handler/service effective state → workload verification.

Serial Execution Ansible boundary map

BoundaryHealthy evidenceSuspicious evidence
Inputs / selectionCorrect inventory, hosts, variables/facts and content are explicitWrong scope, stale facts, hidden precedence or content-version drift
ExecutionConnection, privilege, module/task context and ordering match intentUnreachable, wrong execution host, privilege/plugin failure or misleading skip/change state
Result semanticsPer-host/item results are preserved and interpreted correctlyAggregate recap hides partial/skipped/handled failures
Target proofResource/workload read-back and rerun confirm convergenceGreen Ansible status treated as end-to-end acceptance

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5416

Confirmation

Confirm action

Continue?