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
- Run a Task Only when True
- Branch on OS Family Facts
- Combining Conditions with and / or
- Register a Result, Then Decide