0Pricing
Ansible Academy · Lesson

Branch on OS Family Facts

Different steps for Debian vs RedHat.

One Playbook, Many Distros

Debian uses apt, RedHat uses dnf. With facts and when, a single playbook adapts to each operating system. 🐧

The os_family Fact

Ansible gathers ansible_os_family, a broad label like Debian or RedHat that groups related distributions together.

when: ansible_facts["os_family"] == "Debian"

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