Repository: ansible/ansible

Issue:
Fact ansible_virtualization_role not set in Ansible 2.5.1 on real hardware
##### ISSUE TYPE
 - Bug Report

##### COMPONENT NAME
facts

##### ANSIBLE VERSION
```
2.5.1
```

##### CONFIGURATION

##### OS / ENVIRONMENT
Linux

##### SUMMARY
In Ansible 2.5.1 the fact _ansible_virtualization_role_ is not set when the playbook is run against a real hardware machine (fact is set when run against a VM).

In 2.5.0 it was set on real hardware and had the value _NA_.

##### STEPS TO REPRODUCE
Run this task against a real hardware machine
```yaml
    - name: ansible_virtualization
      debug:
        msg: "ansible_virtualization_role: {{ansible_virtualization_role}}"
```


##### EXPECTED RESULTS
Fact should be set in Ansible 2.5.1 to _NA_ as it was in 2.5.0.

##### ACTUAL RESULTS
With Ansible 2.5.0 the aforementioned code yields:
```
ansible-playbook 2.5.0 
...
ok: [some.hostname] => {
    "msg": "ansible_virtualization_role: NA"
}
```
And with Ansible 2.5.1
```
ansible-playbook 2.5.1
fatal: [some.hostname]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'ansible_virtualization_role' is undefined...
}
```



Discussion:
Files identified in the description:
* [lib/ansible/module_utils/facts](https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/facts)

If these files are inaccurate, please update the `component name` section of the description or use the `!component` bot command.

[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: components_banner --->
@k-c-p Thanks for reporting this issue. Could you please tell us what OS is installed on real hw ?
 needs_info 
Target system is running Debian 7 (Wheezy).

When I run this against a Debian 8 (Jessie) machine, it yields a result. But a surprising one - `host` for real hardware machine is not very intuitive:

```
ansible-playbook 2.5.1 
TASK [debian version information] 
ok: [jessie.host] => {
    "msg": "Debian 8 jessie"
}
TASK [ansible_virtualization] 
ok: [jessie.host] => {
    "msg": "ansible_virtualization_role: host"
}

TASK [debian version information] 
ok: [wheezy.host] => {
    "msg": "Debian 7 wheezy"
}
TASK [ansible_virtualization] task path: /home/charly/eclipseprojects/spp_playground/site.yml:35
fatal: [wheezy.host]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'ansible_virtualization_role' is undefined
```

And to make this even more confusing: If I just run the setup module, I get a result for both Wheezy and Jessie. But the result do not match:
```
$ ansible -vv all -i environments/dev/inventory -m setup -a "filter=ansible_virtualization*"
ansible 2.5.1
wheezy.host | SUCCESS => {
    "ansible_facts": {
        "ansible_virtualization_role": "NA", 
        "ansible_virtualization_type": "NA"
    }, 
    "changed": false
}
jessie.host | SUCCESS => {
    "ansible_facts": {
        "ansible_virtualization_role": "host", 
        "ansible_virtualization_type": "kvm"
    }, 
    "changed": false
}


Resolving patch:
diff --git a/lib/ansible/module_utils/facts/virtual/linux.py b/lib/ansible/module_utils/facts/virtual/linux.py
--- a/lib/ansible/module_utils/facts/virtual/linux.py
+++ b/lib/ansible/module_utils/facts/virtual/linux.py
@@ -242,7 +242,7 @@ def get_virtual_facts(self):
             if rc == 0:
                 # Strip out commented lines (specific dmidecode output)
                 vendor_name = ''.join([line.strip() for line in out.splitlines() if not line.startswith('#')])
-                if vendor_name.startwith('VMware'):
+                if vendor_name.startswith('VMware'):
                     virtual_facts['virtualization_type'] = 'VMware'
                     virtual_facts['virtualization_role'] = 'guest'
                     return virtual_facts


Test patch: