diff --git a/changelogs/fragments/fix-pkg-mgr-in-TencentOS.yml b/changelogs/fragments/fix-pkg-mgr-in-TencentOS.yml new file mode 100644 index 00000000000..cd4d2656ce3 --- /dev/null +++ b/changelogs/fragments/fix-pkg-mgr-in-TencentOS.yml @@ -0,0 +1,2 @@ +bugfixes: + - pkg_mgr.py - Fix `ansible_pkg_mgr` incorrect in TencentOS Server Linux \ No newline at end of file diff --git a/lib/ansible/module_utils/facts/system/pkg_mgr.py b/lib/ansible/module_utils/facts/system/pkg_mgr.py index aef9584356b..1555c3ec4d2 100644 --- a/lib/ansible/module_utils/facts/system/pkg_mgr.py +++ b/lib/ansible/module_utils/facts/system/pkg_mgr.py @@ -93,6 +93,7 @@ class PkgMgrFactCollector(BaseFactCollector): if ( (collected_facts['ansible_distribution'] == 'Fedora' and distro_major_ver < 23) or (collected_facts['ansible_distribution'] == 'Amazon' and distro_major_ver < 2022) + or (collected_facts['ansible_distribution'] == 'TencentOS' and distro_major_ver < 3) or distro_major_ver < 8 # assume RHEL or a clone ) and any(pm for pm in PKG_MGRS if pm['name'] == 'yum' and os.path.exists(pm['path'])): pkg_mgr_name = 'yum'