1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

facts: set virtualization_role for KVM hosts (#50770)

* facts: set virtualization_role for KVM hosts

Fixes #49734

* Add changelog
This commit is contained in:
Martin Krizek 2019-01-17 09:47:16 +01:00 committed by GitHub
parent f06474ae4f
commit 3b42b1796c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 7 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- facts - set virtualization_role for KVM hosts (https://github.com/ansible/ansible/issues/49734)

View file

@ -189,9 +189,10 @@ class LinuxVirtual(Virtual):
modules.append(data[0]) modules.append(data[0])
if 'kvm' in modules: if 'kvm' in modules:
virtual_facts['virtualization_type'] = 'kvm'
virtual_facts['virtualization_role'] = 'host'
if os.path.isdir('/rhev/'): if os.path.isdir('/rhev/'):
# Check whether this is a RHEV hypervisor (is vdsm running ?) # Check whether this is a RHEV hypervisor (is vdsm running ?)
for f in glob.glob('/proc/[0-9]*/comm'): for f in glob.glob('/proc/[0-9]*/comm'):
try: try:
@ -202,12 +203,6 @@ class LinuxVirtual(Virtual):
break break
except Exception: except Exception:
pass pass
else:
virtual_facts['virtualization_type'] = 'kvm'
else:
virtual_facts['virtualization_type'] = 'kvm'
virtual_facts['virtualization_role'] = 'host'
return virtual_facts return virtual_facts