task result
The report a module sends back for each host: a status such as ok, changed, failed, unreachable or skipped, plus data in JSON.
In more detail
The status is the first thing to read, because each one points to a different kind of problem or success. The data underneath depends on the module: the file module reports owner and permissions, the command module reports the return code and output. You can keep a result for later tasks with register.
Related terms
- ok — The task result meaning the module ran and the host already matched the description, so nothing was changed.
- changed — The task result meaning the module ran and altered the host to make it match the description.
- failed — The task result meaning the module ran on the host but could not do what the task asked.
- unreachable — The task result meaning Ansible could not connect to the host at all, so the module never ran.
- skipped — The task result meaning the task was deliberately not run on that host, usually because its when condition was false.
- register — The task keyword that saves a task's result in a named variable so later tasks can read it.
Taught in
- What Configuration Management Is — Ansible Configuration Management at Scale
- Installing Ansible — Ansible Configuration Management at Scale
- Your First Ad Hoc Command — Ansible Configuration Management at Scale
- Connections And Privilege Escalation — Ansible Configuration Management at Scale
- Conditionals: register, when, changed_when And failed_when — RHCE in Ansible (EX294): Automate Red Hat Systems
- Mock Exam, Part 1: Seven Tasks Across Three Sections — RHCE in Ansible (EX294): Automate Red Hat Systems