Linux Labs

Automation: Git and Ansible / Stage 5 of 6

A playbook: tasks, handlers, templates

Not running Starting usually ~20 s
Leave the lesson

Step 6 of 6 · summary · 2 min

Summary

  • A playbook is plays with machines and tasks; PLAY RECAP counts a machine's tasks: ok — passed, changed — changed something.
  • A shell task always answers changed; the file, copy, service modules describe the state and change only the difference — a run with no difference gives changed=0.
  • A handler from handlers fires on notify only when the task changed something — once, at the end of the play.
  • template builds a file from a template with variables, and --check --diff shows what a run would change without changing anything.
  • nginx at the start of the lesson restarted on every run because the restart was a shell task; with a handler it restarts only after a config edit.
Ubuntu 24.04
Loading…