From 2f5c83dfb1855342389436e72d64cf7afe9698e6 Mon Sep 17 00:00:00 2001 From: Sam Doran Date: Tue, 9 Feb 2021 13:04:39 -0500 Subject: [PATCH] Add AlmaLinux to the family of Red Hat-like operating systems (#73541) * Add changelog and fixtures for AlmaLinux support Co-authored-by: Christoph Schug --- changelogs/fragments/support_almalinux.yml | 2 + .../module_utils/facts/system/distribution.py | 2 +- .../fixtures/almalinux_8_3_beta.json | 53 +++++++++++++++++++ 3 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/support_almalinux.yml create mode 100644 test/units/module_utils/facts/system/distribution/fixtures/almalinux_8_3_beta.json diff --git a/changelogs/fragments/support_almalinux.yml b/changelogs/fragments/support_almalinux.yml new file mode 100644 index 00000000000..4dbc040a62f --- /dev/null +++ b/changelogs/fragments/support_almalinux.yml @@ -0,0 +1,2 @@ +bugfixes: + - add AlmaLinux to fact gathering (https://github.com/ansible/ansible/pull/73458) diff --git a/lib/ansible/module_utils/facts/system/distribution.py b/lib/ansible/module_utils/facts/system/distribution.py index a31aa197f57..fd49b3a6fbd 100644 --- a/lib/ansible/module_utils/facts/system/distribution.py +++ b/lib/ansible/module_utils/facts/system/distribution.py @@ -464,7 +464,7 @@ class Distribution(object): OS_FAMILY_MAP = {'RedHat': ['RedHat', 'Fedora', 'CentOS', 'Scientific', 'SLC', 'Ascendos', 'CloudLinux', 'PSBM', 'OracleLinux', 'OVS', 'OEL', 'Amazon', 'Virtuozzo', 'XenServer', 'Alibaba', - 'EulerOS', 'openEuler'], + 'EulerOS', 'openEuler', 'AlmaLinux'], 'Debian': ['Debian', 'Ubuntu', 'Raspbian', 'Neon', 'KDE neon', 'Linux Mint', 'SteamOS', 'Devuan', 'Kali', 'Cumulus Linux', 'Pop!_OS', 'Parrot', 'Pardus GNU/Linux'], diff --git a/test/units/module_utils/facts/system/distribution/fixtures/almalinux_8_3_beta.json b/test/units/module_utils/facts/system/distribution/fixtures/almalinux_8_3_beta.json new file mode 100644 index 00000000000..2d8df50bf12 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/almalinux_8_3_beta.json @@ -0,0 +1,53 @@ +{ + "name": "AlmaLinux 8.3", + "distro": { + "codename": "Purple Manul", + "id": "almalinux", + "name": "AlmaLinux", + "version": "8.3", + "version_best": "8.3", + "lsb_release_info": { + "lsb_version": ":core-4.1-amd64:core-4.1-noarch", + "distributor_id": "AlmaLinux", + "description": "AlmaLinux release 8.3 Beta (Purple Manul)", + "release": "8.3", + "codename": "PurpleManul" + }, + "os_release_info": { + "name": "AlmaLinux", + "version": "8.3 (Purple Manul)", + "id": "almalinux", + "id_like": "rhel centos fedora", + "version_id": "8.3", + "platform_id": "platform:el8", + "pretty_name": "AlmaLinux 8.3 Beta (Purple Manul)", + "ansi_color": "0;34", + "cpe_name": "cpe:/o:almalinux:almalinux:8.3:beta", + "home_url": "https://almalinux.org/", + "bug_report_url": "https://bugs.almalinux.org/", + "almalinux_mantisbt_project": "AlmaLinux-8", + "almalinux_mantisbt_project_version": "8", + "codename": "Purple Manul" + } + }, + "input": { + "/etc/centos-release": "AlmaLinux release 8.3 Beta (Purple Manul)\n", + "/etc/redhat-release": "AlmaLinux release 8.3 Beta (Purple Manul)\n", + "/etc/system-release": "AlmaLinux release 8.3 Beta (Purple Manul)\n", + "/etc/os-release": "NAME=\"AlmaLinux\"\nVERSION=\"8.3 (Purple Manul)\"\nID=\"almalinux\"\nID_LIKE=\"rhel centos fedora\"\nVERSION_ID=\"8.3\"\nPLATFORM_ID=\"platform:el8\"\nPRETTY_NAME=\"AlmaLinux 8.3 Beta (Purple Manul)\"\nANSI_COLOR=\"0;34\"\nCPE_NAME=\"cpe:/o:almalinux:almalinux:8.3:beta\"\nHOME_URL=\"https://almalinux.org/\"\nBUG_REPORT_URL=\"https://bugs.almalinux.org/\"\n\nALMALINUX_MANTISBT_PROJECT=\"AlmaLinux-8\" \nALMALINUX_MANTISBT_PROJECT_VERSION=\"8\" \n\n", + "/usr/lib/os-release": "NAME=\"AlmaLinux\"\nVERSION=\"8.3 (Purple Manul)\"\nID=\"almalinux\"\nID_LIKE=\"rhel centos fedora\"\nVERSION_ID=\"8.3\"\nPLATFORM_ID=\"platform:el8\"\nPRETTY_NAME=\"AlmaLinux 8.3 Beta (Purple Manul)\"\nANSI_COLOR=\"0;34\"\nCPE_NAME=\"cpe:/o:almalinux:almalinux:8.3:beta\"\nHOME_URL=\"https://almalinux.org/\"\nBUG_REPORT_URL=\"https://bugs.almalinux.org/\"\n\nALMALINUX_MANTISBT_PROJECT=\"AlmaLinux-8\" \nALMALINUX_MANTISBT_PROJECT_VERSION=\"8\" \n\n" + }, + "platform.dist": [ + "almalinux", + "8.3", + "Purple Manul" + ], + "result": { + "distribution": "AlmaLinux", + "distribution_version": "8.3", + "distribution_release": "Purple Manul", + "distribution_major_version": "8", + "os_family": "RedHat" + }, + "platform.release": "4.18.0-240.el8.x86_64" +}