Repository: ansible/ansible

Issue:
SLES 11 SP Information Reported by Ansible Inconsistent Between Releases
##### Issue Type:
- Bug Report
##### Ansible Version:

```
$ ansible --version
ansible 2.0.0.2
```
##### Ansible Configuration:

```
$ cat ansible.cfg
[defaults]
inventory = .vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory
remote_user = vagrant
private_key_file = .vagrant/machines/default/vsphere/private_key
```
##### Environment:

Running from:

```
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04 LTS"
```

Managing SLES 11 SP3 and SP4
##### Summary:

The version information between SLES 11 service packs is inconsistent.
##### Steps To Reproduce:

Run Ansible against SLES 11 SP3 and check facts. See following.

```
"ansible_distribution": "SLES",
"ansible_distribution_major_version": "11",
"ansible_distribution_release": "3",
"ansible_distribution_version": "11.3",
```

Run Ansible against SLES 11 SP4 and check facts. See following.

```
"ansible_distribution": "SLES",
"ansible_distribution_major_version": "11",
"ansible_distribution_release": "0",
"ansible_distribution_version": "11.4",
```
##### Expected Results:

Run Ansible against SLES 11 SP4 and check facts. See following.

```
"ansible_distribution": "SLES",
"ansible_distribution_major_version": "11",
"ansible_distribution_release": "4",
"ansible_distribution_version": "11.4",
```
##### Actual Results:

Run Ansible against SLES 11 SP4 and check facts. See following.

```
"ansible_distribution": "SLES",
"ansible_distribution_major_version": "11",
"ansible_distribution_release": "0",
"ansible_distribution_version": "11.4",
```



Discussion:
Can you give the content of `/etc/os-release` in both cases? 

I guess the problem is in the lines leading up to
https://github.com/ansible/ansible/blob/66328e5200e1e314af44325cbc6828407b70ac6b/lib/ansible/module_utils/facts.py#L463

**SLES 11.3**

```
> cat /etc/os-release
cat: /etc/os-release: No such file or directory
> cat /etc/SuSE-release
SUSE Linux Enterprise Server 11 (x86_64)
VERSION = 11
PATCHLEVEL = 3
```

**SLES 11.4**

```
> cat /etc/os-release
NAME="SLES"
VERSION="11.4"
VERSION_ID="11.4"
PRETTY_NAME="SUSE Linux Enterprise Server 11 SP4"
ID="sles"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:suse:sles:11:4"
> cat /etc/SuSE-release
SUSE Linux Enterprise Server 11 (x86_64)
VERSION = 11
PATCHLEVEL = 4
```

In SP3 the file /etc/os-release is missing. It's a completely clean install, so I doubt very much that it was removed by me.

I guess in SP3 it'll use `/etc/SuSE-release` instead then. I was looking at it yesterday but didn't have time to get into which one it uses on SP4, and why.

Thanks for taking the time to look into this!


Resolving patch:
diff --git a/lib/ansible/module_utils/facts.py b/lib/ansible/module_utils/facts.py
--- a/lib/ansible/module_utils/facts.py
+++ b/lib/ansible/module_utils/facts.py
@@ -484,6 +484,7 @@ def get_distribution_facts(self):
                                             if release:
                                                 self.facts['distribution_release'] = release.group(1)
                                                 self.facts['distribution_version'] = self.facts['distribution_version'] + '.' + release.group(1)
+                                    break
                         elif name == 'Debian':
                             data = get_file_content(path)
                             if 'Debian' in data or 'Raspbian' in data:


Test patch: