From d5eff47fcc1f06c581d2a98f3e450b3070fcb56c Mon Sep 17 00:00:00 2001 From: gl0bus Date: Fri, 2 Dec 2016 18:23:43 +0100 Subject: [PATCH] Extend OpenStack related hypervisor detection (#15166) * fixed detection of ansible_virtualization_(role|path) facts for VM's running in OpenStack Instances * NOTE: this will break detection of ansible_virtualization_(role|path) facts if you are using Openstack Instaces with nested virtualization * fixed detection of ansible_virtualization_(role|path) facts for VM's running in OpenStack Instances Fixes #15165 * NOTE: this will break detection of ansible_virtualization_(role|path) facts if you are using Openstack Instaces with nested virtualization --- lib/ansible/module_utils/facts.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/ansible/module_utils/facts.py b/lib/ansible/module_utils/facts.py index 6c0049649ff..24014081407 100644 --- a/lib/ansible/module_utils/facts.py +++ b/lib/ansible/module_utils/facts.py @@ -3259,6 +3259,11 @@ class LinuxVirtual(Virtual): self.facts['virtualization_role'] = 'guest' return + if product_name == 'OpenStack Nova': + self.facts['virtualization_type'] = 'openstack' + self.facts['virtualization_role'] = 'guest' + return + bios_vendor = get_file_content('/sys/devices/virtual/dmi/id/bios_vendor') if bios_vendor == 'Xen': @@ -3294,6 +3299,11 @@ class LinuxVirtual(Virtual): self.facts['virtualization_role'] = 'guest' return + if sys_vendor == 'OpenStack Foundation': + self.facts['virtualization_type'] = 'openstack' + self.facts['virtualization_role'] = 'guest' + return + if os.path.exists('/proc/self/status'): for line in get_file_lines('/proc/self/status'): if re.match('^VxID: \d+', line):