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 0000000000..7a31da54c6 --- /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 a7dec44457..4fe36ff7aa 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