Hello All,
I have a general question!
When should I use ansible_facts.distribution vs ansible_os_family or are they interchangeable? Is one better than the other?
Thanks,
Hello All,
I have a general question!
When should I use ansible_facts.distribution vs ansible_os_family or are they interchangeable? Is one better than the other?
Thanks,
ansible_facts.distribution (aka ansible_distribution) and
ansible_facts.os_family (aka ansible_os_family) are just 2 diff sets
of data.
For example on Ubuntu, family will be 'debian' while distribution will
be 'ubuntu', sometimes they can be the same (i.e while using debian)
but they are meant to indicate specific things that are different.
As to when to use them .. that depends on your context, what
distinction is needed.
ansible_os_family is for assigning tasks, variables etc. to a family of operating systems (i.e Debian, RedHat etc)
Debian will match Debian, Ubuntu, any other derived Debian distribution
RedHat will match RedHat, CentOS, Fedora, any other derived RedHat distribution
the assumption is that in the same family the things are the same (i.e. apache is apache2 in Debian family, but httpd in RedHat family)
if you need finer grain you could use ansible_distribution, which will give you the exact linux distribution
in most cases os_family will be enough, but when it comes to package versions (like php-7.x) maybe you will need also ansible_distribution_major_version
Alex
Pe luni, 5 octombrie 2020, la 15:48:48 UTC+3, mills....@gmail.com a scris:
Thanks Brian! That helped a lot.
Thanks Alex! that helped a lot.