ansible_os_family values

Hi,

I know ansible_os_family can be “RedHat” or “Debian”, where “RedHat” includes Fedora
and “Debian” is for Ubuntu. Where to find the list of all values that “ansible_os_family”
can take? It would be awesome if every value also included most popular examples of
named families.

There’s a list in library/system/setup

Hi,

personally if I do not found this kind of item in documentation, I`ll look into code :). In this case, setup module.

OS_FAMILY = dict(
RedHat = ‘RedHat’, Fedora = ‘RedHat’, CentOS = ‘RedHat’, Scientific = ‘RedHat’,
SLC = ‘RedHat’, Ascendos = ‘RedHat’, CloudLinux = ‘RedHat’, PSBM = ‘RedHat’,
OracleLinux = ‘RedHat’, OVS = ‘RedHat’, OEL = ‘RedHat’, Amazon = ‘RedHat’,
XenServer = ‘RedHat’, Ubuntu = ‘Debian’, Debian = ‘Debian’, SLES = ‘Suse’,
SLED = ‘Suse’, OpenSuSE = ‘Suse’, SuSE = ‘Suse’, Gentoo = ‘Gentoo’,
Archlinux = ‘Archlinux’, Mandriva = ‘Mandrake’, Mandrake = ‘Mandrake’,
Solaris = ‘Solaris’, Nexenta = ‘Solaris’, OmniOS = ‘Solaris’, OpenIndiana = ‘Solaris’,
SmartOS = ‘Solaris’, AIX = ‘AIX’, Alpine = ‘Alpine’, MacOSX = ‘Darwin’,
FreeBSD = ‘FreeBSD’, HPUX = ‘HP-UX’
)

Thanks everyone for the hints. Just for reference direct link to the sources.

https://github.com/ansible/ansible/blob/devel/library/system/setup#L241

How to check for sunos using sparc machines using ansible_os_family ?

With ansible 2.4 round the corner, devel branch has it in build/lib/ansible/module_utils/facts.py

Funny how I have “windows” in my OS_family variable, but it is not member of this dict. Are there 2 separate instances of this in the code, one for linux and one for windows hosts?

The Windows setup module is a completely separate thing (written in Powershell)

For anyone stumbling on this now, the values have been moved to this file (module_utils/facts/system/distribution.py). I’ve run into this thread twice looking for that and should have updated it the first time I found the moved file. Some useful lines:

Submitted a pull request to document the possible values: https://github.com/ansible/ansible/pull/34263

You could also reference their documentation.

https://docs.ansible.com/ansible/latest/user_guide/playbooks_conditionals.html#id18

Contains this kind of information in a different format.