diff --git a/changelogs/fragments/os-family_distro_variable_clearlinux.yaml b/changelogs/fragments/os-family_distro_variable_clearlinux.yaml new file mode 100644 index 0000000000..f773e26831 --- /dev/null +++ b/changelogs/fragments/os-family_distro_variable_clearlinux.yaml @@ -0,0 +1,2 @@ +minor_changes: +- set ansible_os_family from name variable in os-release diff --git a/lib/ansible/module_utils/facts/system/distribution.py b/lib/ansible/module_utils/facts/system/distribution.py index 556b0a0ecc..a0dbf0d366 100644 --- a/lib/ansible/module_utils/facts/system/distribution.py +++ b/lib/ansible/module_utils/facts/system/distribution.py @@ -386,6 +386,9 @@ class DistributionFiles: release = re.search('ID=(.*)', data) if release: clear_facts['distribution_release'] = release.groups()[0] + pname = re.search('NAME="(.*)"', data) + if pname: + clear_facts['distribution'] = pname.groups()[0] return True, clear_facts @@ -450,7 +453,8 @@ class Distribution(object): 'AIX': ['AIX'], 'HP-UX': ['HPUX'], 'Darwin': ['MacOSX'], - 'FreeBSD': ['FreeBSD', 'TrueOS']} + 'FreeBSD': ['FreeBSD', 'TrueOS'], + 'ClearLinux': ['Clear Linux OS', 'Clear Linux Mix']} OS_FAMILY = {} for family, names in OS_FAMILY_MAP.items(): diff --git a/test/units/module_utils/test_distribution_version.py b/test/units/module_utils/test_distribution_version.py index 38ccf8d941..f475cb5bcc 100644 --- a/test/units/module_utils/test_distribution_version.py +++ b/test/units/module_utils/test_distribution_version.py @@ -949,7 +949,7 @@ PRIVACY_POLICY_URL="http://www.intel.com/privacy" "name": "ClearLinux 26580", "result": { "distribution_release": "clear-linux-os", - "distribution": "ClearLinux", + "distribution": "Clear Linux OS", "distribution_major_version": "26580", "os_family": "ClearLinux", "distribution_version": "26580"