Quiz Entry - updated: 2026.12.01
In short: which tool do you use for each file job: deploy a fixed file, deploy a per-host config, change one setting, add a snippet, delete a file, check a file, collect a file, mirror a directory tree?
copy, template, lineinfile, blockinfile, file with state: absent, stat, fetch, synchronize.
| Job | Module | Key options |
|---|---|---|
| Deploy a fixed file | copy |
src, dest, mode, force |
| Deploy a per-host config | template |
src (.j2), dest, validate |
| Change one setting | lineinfile |
regexp, line |
| Add a multi-line snippet | blockinfile |
block, marker |
| Create, delete, set attributes | file |
state, owner, mode, setype |
| Check before acting | stat |
path, then register and when |
| Collect from hosts | fetch |
src, dest, flat |
| Mirror a directory tree | ansible.posix.synchronize |
src, dest, delete |
All of them describe an end state and report changed only when they had to act, so they combine with handlers: a template that changed a config notifies the restart, an identical one doesn't.
Go deeper:
The ansible.builtin collection index (official docs) — every module in
ansible.builtin.