From 22b10a8f6e928fcfbd23a22e4a63a7f53177fa76 Mon Sep 17 00:00:00 2001 From: Eri Bastos Date: Fri, 20 Mar 2015 14:40:44 -0300 Subject: [PATCH] Patch for bug #10485 - ansible_distribution fact populates as 'RedHat' on Oracle Linux systems --- lib/ansible/module_utils/facts.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/ansible/module_utils/facts.py b/lib/ansible/module_utils/facts.py index 424c388fb6e..18d8f665a24 100644 --- a/lib/ansible/module_utils/facts.py +++ b/lib/ansible/module_utils/facts.py @@ -87,7 +87,8 @@ class Facts(object): _I386RE = re.compile(r'i([3456]86|86pc)') # For the most part, we assume that platform.dist() will tell the truth. # This is the fallback to handle unknowns or exceptions - OSDIST_LIST = ( ('/etc/redhat-release', 'RedHat'), + OSDIST_LIST = ( ('/etc/oracle-release', 'Oracle Linux'), + ('/etc/redhat-release', 'RedHat'), ('/etc/vmware-release', 'VMwareESX'), ('/etc/openwrt_release', 'OpenWrt'), ('/etc/system-release', 'OtherLinux'), @@ -287,6 +288,13 @@ class Facts(object): # Once we determine the value is one of these distros # we trust the values are always correct break + elif name == 'Oracle Linux': + data = get_file_content(path) + if 'Oracle Linux' in data: + self.facts['distribution'] = name + else: + self.facts['distribution'] = data.split()[0] + break elif name == 'RedHat': data = get_file_content(path) if 'Red Hat' in data: