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
changes/30/593730/3
Monty Taylor 4 years ago
parent ac3d9d4651
commit 1b54971705
  1. 5
      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)

Loading…
Cancel
Save