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

Add BIOS information and fix VMware detection (supports both IDE and SCSI disks)

This commit is contained in:
Dag Wieers 2012-05-30 14:23:52 +02:00
parent af9651f015
commit 50ef1bb93f

View file

@ -48,7 +48,9 @@ DMI_DICT = { 'form_factor': '/sys/devices/virtual/dmi/id/chassis_type',
'product_serial': '/sys/devices/virtual/dmi/id/product_serial', 'product_serial': '/sys/devices/virtual/dmi/id/product_serial',
'product_uuid': '/sys/devices/virtual/dmi/id/product_uuid', 'product_uuid': '/sys/devices/virtual/dmi/id/product_uuid',
'product_version': '/sys/devices/virtual/dmi/id/product_version', 'product_version': '/sys/devices/virtual/dmi/id/product_version',
'system_vendor': '/sys/devices/virtual/dmi/id/sys_vendor' } 'system_vendor': '/sys/devices/virtual/dmi/id/sys_vendor',
'bios_date': '/sys/devices/virtual/dmi/id/bios_date',
'bios_version': '/sys/devices/virtual/dmi/id/bios_version' }
# From smolt and DMI spec # From smolt and DMI spec
FORM_FACTOR = [ "Unknown", "Other", "Unknown", "Desktop", FORM_FACTOR = [ "Unknown", "Other", "Unknown", "Desktop",
"Low Profile Desktop", "Pizza Box", "Mini Tower", "Tower", "Low Profile Desktop", "Pizza Box", "Mini Tower", "Tower",
@ -186,7 +188,7 @@ def get_linux_virtual_facts(facts):
facts['virtualization_type'] = 'VMware' facts['virtualization_type'] = 'VMware'
facts['virtualization_role'] = 'host' facts['virtualization_role'] = 'host'
# You can spawn a dmidecode process and parse that or infer from devices # You can spawn a dmidecode process and parse that or infer from devices
for dev_model in glob.glob('/proc/ide/hd*/model'): for dev_model in glob.glob('/sys/block/?da/device/vendor'):
info = open(dev_model).read() info = open(dev_model).read()
if 'VMware' in info: if 'VMware' in info:
facts['virtualization_type'] = 'VMware' facts['virtualization_type'] = 'VMware'