From 7d0237f4db2b637eb089ac3ecc6d5f56c5c554ef Mon Sep 17 00:00:00 2001 From: Tim Hunter Date: Thu, 30 May 2019 04:18:31 -0400 Subject: [PATCH] update pkg_mgr.py for Amazon Linux support (#56618) (cherry picked from commit 4c00fc7b3274da924844742a073b864c50969fca) --- .../56618-update-pkg_mgr.py-for-Amazon-Linux-support.yaml | 2 ++ lib/ansible/module_utils/facts/system/pkg_mgr.py | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/56618-update-pkg_mgr.py-for-Amazon-Linux-support.yaml diff --git a/changelogs/fragments/56618-update-pkg_mgr.py-for-Amazon-Linux-support.yaml b/changelogs/fragments/56618-update-pkg_mgr.py-for-Amazon-Linux-support.yaml new file mode 100644 index 00000000000..7a31da54c68 --- /dev/null +++ b/changelogs/fragments/56618-update-pkg_mgr.py-for-Amazon-Linux-support.yaml @@ -0,0 +1,2 @@ +bugfixes: + - pkg_mgr - Ansible 2.8.0 failing to install yum packages on Amazon Linux (https://github.com/ansible/ansible/issues/56583) diff --git a/lib/ansible/module_utils/facts/system/pkg_mgr.py b/lib/ansible/module_utils/facts/system/pkg_mgr.py index a7dec44457c..4fe36ff7aad 100644 --- a/lib/ansible/module_utils/facts/system/pkg_mgr.py +++ b/lib/ansible/module_utils/facts/system/pkg_mgr.py @@ -78,9 +78,11 @@ class PkgMgrFactCollector(BaseFactCollector): # If there's some new magical Fedora version in the future, # just default to dnf pkg_mgr_name = 'dnf' + elif collected_facts['ansible_distribution'] == 'Amazon': + pkg_mgr_name = 'yum' else: - # If it's not Fedora and it's Red Hat family of distros, assume RHEL - # or a clone. For versions of RHEL < 8 that Ansible supports, the + # If it's not one of the above and it's Red Hat family of distros, assume + # RHEL or a clone. For versions of RHEL < 8 that Ansible supports, the # vendor supported official package manager is 'yum' and in RHEL 8+ # (as far as we know at the time of this writing) it is 'dnf'. # If anyone wants to force a non-official package manager then they