Register a Result, Then Decide
Use registered output in conditions.
React to What Happened
Often the next step depends on the last one. The register keyword saves a task's result so later tasks can read it. 📥
Capturing Output
Add register to store the result in a variable of your choosing. Here the command output lands in result.
- name: Check disk
ansible.builtin.command: df -h /
register: resultAll lessons in this course
- Run a Task Only when True
- Branch on OS Family Facts
- Combining Conditions with and / or
- Register a Result, Then Decide