From 1b5497170564f52d186ff764a2155434d57b065a Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Mon, 20 Aug 2018 13:17:36 -0500 Subject: [PATCH] Ensure apt is used on ubuntu hosts with zypper There is an issue with our nb0* hosts where they have zypper installed for building suse images but that tricks ansible in to thinking it should use zypper for package management. This has been submitted upstream as https://github.com/ansible/ansible/pull/44413 Change-Id: I96f60501e43bfe9c6acb4ce80f8450b245943ca8 --- playbooks/module_utils/facts/system/pkg_mgr.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/playbooks/module_utils/facts/system/pkg_mgr.py b/playbooks/module_utils/facts/system/pkg_mgr.py index ec3a13de30..50c20bf2b2 100644 --- a/playbooks/module_utils/facts/system/pkg_mgr.py +++ b/playbooks/module_utils/facts/system/pkg_mgr.py @@ -126,6 +126,11 @@ class PkgMgrFactCollector(BaseFactCollector): if pkg_mgr_name == 'apt': pkg_mgr_name = 'apt_rpm' + elif collected_facts['ansible_os_family'] == 'Debian' and pkg_mgr_name != 'apt': + # It's possible to install yum, dnf, zypper, rpm, etc inside of + # Debian. Doing so does not mean the system wants to use them. + pkg_mgr_name = 'apt' + # Check if /usr/bin/apt-get is ordinary (dpkg-based) APT or APT-RPM if pkg_mgr_name == 'apt': pkg_mgr_name = self._check_apt_flavor(pkg_mgr_name)