Interview Prep/Ansible/Playbooks, Plays, Tasks and Handlers

What are strategies and how do `linear`, `free` and `debug` differ?

AdvancedConceptPlaybooks, Plays, Tasks and Handlers
Answer

A strategy controls how tasks are scheduled across hosts.

  • linear (default): each task runs on all hosts in the batch and Ansible waits for the slowest before starting the next task.
  • free: each host runs through the play at its own speed without waiting for others. Good when host speeds vary a lot and tasks are independent.
  • host_pinned: like free but keeps a host on a worker until it finishes the play.
  • debug: drops into an interactive debugger when a task fails.
- hosts: web
  strategy: free

Output order becomes interleaved with free, and run_once and cross-host dependencies get harder to reason about.

All Ansible questions Roadmap: Ansible

More on Playbooks, Plays, Tasks and Handlers