0Pricing
Ansible Academy · Lesson

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: result

All lessons in this course

  1. Run a Task Only when True
  2. Branch on OS Family Facts
  3. Combining Conditions with and / or
  4. Register a Result, Then Decide
← Back to Ansible Academy