diff --git a/lib/ansible/module_utils/facts.py b/lib/ansible/module_utils/facts.py index d3faeaae2ac..2fb44db97bc 100644 --- a/lib/ansible/module_utils/facts.py +++ b/lib/ansible/module_utils/facts.py @@ -334,12 +334,13 @@ class Facts(object): self.facts[factname] = keydata.split()[1] def get_pkg_mgr_facts(self): - self.facts['pkg_mgr'] = 'unknown' - for pkg in Facts.PKG_MGRS: - if os.path.exists(pkg['path']): - self.facts['pkg_mgr'] = pkg['name'] if self.facts['system'] == 'OpenBSD': self.facts['pkg_mgr'] = 'openbsd_pkg' + else: + self.facts['pkg_mgr'] = 'unknown' + for pkg in Facts.PKG_MGRS: + if os.path.exists(pkg['path']): + self.facts['pkg_mgr'] = pkg['name'] def get_service_mgr_facts(self): #TODO: detect more custom init setups like bootscripts, dmd, s6, Epoch, runit, etc