mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Implement basic DMI facts for OpenBSD
This commit is contained in:
parent
309f54b709
commit
88970bcfb2
1 changed files with 21 additions and 1 deletions
|
@ -1585,7 +1585,8 @@ class OpenBSDHardware(Hardware):
|
|||
- processor_cores
|
||||
- processor_count
|
||||
- processor_speed
|
||||
- devices
|
||||
|
||||
In addition, it also defines number of DMI facts and device facts.
|
||||
"""
|
||||
platform = 'OpenBSD'
|
||||
DMESG_BOOT = '/var/run/dmesg.boot'
|
||||
|
@ -1665,6 +1666,25 @@ class OpenBSDHardware(Hardware):
|
|||
devices.extend(self.sysctl['hw.disknames'].split(','))
|
||||
self.facts['devices'] = devices
|
||||
|
||||
def get_dmi_facts(self):
|
||||
# We don't use dmidecode(1) here because:
|
||||
# - it would add dependency on an external package
|
||||
# - dmidecode(1) can only be ran as root
|
||||
# So instead we rely on sysctl(8) to provide us the information on a
|
||||
# best-effort basis. As a bonus we also get facts on non-amd64/i386
|
||||
# platforms this way.
|
||||
sysctl_to_dmi = {
|
||||
'hw.product': 'product_name',
|
||||
'hw.version': 'product_version',
|
||||
'hw.uuid': 'product_uuid',
|
||||
'hw.serialno': 'product_serial',
|
||||
'hw.vendor': 'system_vendor',
|
||||
}
|
||||
|
||||
for mib in sysctl_to_dmi:
|
||||
if mib in self.sysctl:
|
||||
self.facts[sysctl_to_dmi[mib]] = self.sysctl[mib]
|
||||
|
||||
class FreeBSDHardware(Hardware):
|
||||
"""
|
||||
FreeBSD-specific subclass of Hardware. Defines memory and CPU facts:
|
||||
|
|
Loading…
Reference in a new issue