List of Ansible OS Family & OS Distribution Facts

Ansible is a powerful and widely adopted automation tool for SysAdmins, Developers, Network Engineers and many other users. When writing Ansible playbooks you may want to execute different tasks, or have different goals, depending on the value of a fact (data about the remote system), a variable, or the result of a previous task.

One of the condition is execution of a task if the OS family or OS Distribution is matched. This is usually achieved by using ansible_facts[‘os_family’] & ansible_facts[‘distribution’] fact. Ansible facts are variables containing information about the remote systems to be managed. With facts, you can use the behavior or state of one system as configuration on other systems.

In this guide we share a list of OS Family and OS distributions and how Ansible will group then.

Common Ansible OS Family & Distribution Facts

1. RedHat OS Family

Below is a list of OS distributions that fit into RedHat OS Family:

  • RedHat
  • CentOS
  • Fedora
  • Scientific
  • CloudLinux
  • OracleLinux
  • Amazon
  • XenServer

Usage examples:

# OS Family
when: ansible_facts['os_family'] == "RedHat" # CentOS 8, CentOS 7,Fedora 33, Amazon Linux 2, e.t.c

# Apply condition to a specific Distribution
when: ansible_facts['distribution'] == "CentOS" # CentOS 8,7,6
when: ansible_facts['distribution'] == "Amazon" # Amazon Linux
when: ansible_facts['distribution'] == "Fedora" # Fedora 33,32,31,..
when: (ansible_facts['distribution'] == "CentOS" and ansible_facts['distribution_major_version'] == "8") # CentOS 8 only

2. Debian OS Family

Distributions:

  • Debian
  • Ubuntu

Usage examples:

# Apply to either
when: ansible_facts['os_family'] == "Debian" # Debian 10,9,..,Ubuntu 20.04,18.04,e.t.c

# Specific distribution examples:
when: ansible_facts['distribution'] == "Debian" # Debian 10,9,8,..
when: ansible_facts['distribution'] == "Ubuntu" # Ubuntu 20.04, 18.04, 16.04,..
when: (ansible_facts['distribution'] == "Debian" and ansible_facts['distribution_major_version'] == "10") # Only Debian 10
when: (ansible_facts['distribution'] == "Ubuntu" and ansible_facts['distribution_major_version'] == "20") # Only Ubuntu 20.04

3. Suse OS Family

  • SUSE
  • SLED – SUSE Linux Enterprise Desktop
  • SLES – SUSE Linux Enterprise Server
when: ansible_facts['os_family'] == "Suse"
when: ansible_facts['distribution'] == "SLES"

4. Gentoo OS Family

  • Gentoo
when: ansible_facts['os_family'] == "Gentoo"
when: ansible_facts['distribution'] == "Gentoo"

5. Archlinux OS Family

  • Archlinux
when: ansible_facts['os_family'] == "Archlinux"
when: ansible_facts['distribution'] == "Archlinux"

6. Mandrake OS Family

  • Mandriva
when: ansible_facts['os_family'] == "Mandrake"
when: ansible_facts['distribution'] == "Mandriva"

7. Solaris OS Family

  • Solaris
  • Nexenta
  • OmniOS
  • OpenIndiana
  • SmartOS
when: ansible_facts['os_family'] == "Solaris"
when: ansible_facts['distribution'] == "OmniOS"
when: ansible_facts['distribution'] == "SmartOS"

8. AIX

when: ansible_facts['os_family'] == "AIX"

9. Alpine OS Family

  • Alpine Linux
when: ansible_facts['os_family'] == "Alpine"
when: ansible_facts['distribution'] == "Alpine"

10. macOS – Darwin

when: ansible_facts['os_family'] == "Darwin"

11. FreeBSD

  • FreeBSD
when: ansible_facts['os_family'] == "FreeBSD"

12. HP-UX

  • HP-UX
when: ansible_facts['os_family'] == "HP-UX"

13. Windows

when: ansible_facts['os_family'] == "Windows"

Extra Distribution examples

  • VMware ESXi
when: ansible_facts['distribution'] == "VMwareESX"
  • OpenWrt
when: ansible_facts['distribution'] == "OpenWrt"
  • CoreOS
when: ansible_facts['distribution'] == "Coreos"
  • ALT Linux
when: ansible_facts['distribution'] == "Altlinux"

More guides on Ansible:

Join our Linux and open source community. Subscribe to our newsletter for tips, tricks, and collaboration opportunities!

Recent Post

Unlock the Right Solutions with Confidence

At CloudSpinx, we don’t just offer services - we deliver clarity, direction, and results. Whether you're navigating cloud adoption, scaling infrastructure, or solving DevOps challenges, our seasoned experts help you make smart, strategic decisions with total confidence. Let us turn complexity into opportunity and bring your vision to life.

Leave a Comment

Your email address will not be published. Required fields are marked *

Related Post

LAMP is an acronym for Linux, Apache, MySQL and PHP, which are open-source software that work together to build powerful […]

Rook is a robust and open source solution used to orchestrate distributed storage systems, particularly in cloud native environments. The […]

s5cmd is a CLI utility used to access S3 bucket and manage files – upload, or delete objects in an S3 […]

Let's Connect

Unleash the full potential of your business with CloudSpinx. Our expert solutions specialists are standing by to answer your questions and tailor a plan that perfectly aligns with your unique needs.
You will get a response from our solutions specialist within 12 hours
We understand emergencies can be stressful. For immediate assistance, chat with us now

Contact CloudSpinx today!

Download CloudSpinx Profile

Discover the full spectrum of our expertise and services by downloading our detailed Company Profile. Simply enter your first name, last name, and email address.