diff --git a/lib/ansible/module_utils/facts.py b/lib/ansible/module_utils/facts.py index 1ba61bb77f0..4c7571ce3c5 100644 --- a/lib/ansible/module_utils/facts.py +++ b/lib/ansible/module_utils/facts.py @@ -418,9 +418,9 @@ class Facts(object): release = re.search("^PRETTY_NAME=[^(]+ \(?([^)]+?)\)", line) if release: self.facts['distribution_release'] = release.groups()[0] - elif 'enterprise' in data.lower(): + elif 'enterprise' in data.lower() and 'VERSION_ID' in line: release = re.search('^VERSION_ID="?[0-9]+\.?([0-9]*)"?', line) # SLES doesn't got funny release names - if release: + if release.group(1): release = release.group(1) else: release = "0" # no minor number, so it is the first release