|
|
|
@ -17,6 +17,7 @@ from __future__ import (absolute_import, division, print_function)
|
|
|
|
|
__metaclass__ = type
|
|
|
|
|
|
|
|
|
|
import re
|
|
|
|
|
import time
|
|
|
|
|
|
|
|
|
|
from ansible.module_utils._text import to_text
|
|
|
|
|
|
|
|
|
@ -45,13 +46,14 @@ class OpenBSDHardware(Hardware):
|
|
|
|
|
|
|
|
|
|
def populate(self, collected_facts=None):
|
|
|
|
|
hardware_facts = {}
|
|
|
|
|
self.sysctl = get_sysctl(self.module, ['hw'])
|
|
|
|
|
self.sysctl = get_sysctl(self.module, ['hw', 'kern'])
|
|
|
|
|
|
|
|
|
|
# TODO: change name
|
|
|
|
|
cpu_facts = self.get_processor_facts()
|
|
|
|
|
memory_facts = self.get_memory_facts()
|
|
|
|
|
device_facts = self.get_device_facts()
|
|
|
|
|
dmi_facts = self.get_dmi_facts()
|
|
|
|
|
uptime_facts = self.get_uptime_facts()
|
|
|
|
|
|
|
|
|
|
mount_facts = {}
|
|
|
|
|
try:
|
|
|
|
@ -64,6 +66,7 @@ class OpenBSDHardware(Hardware):
|
|
|
|
|
hardware_facts.update(dmi_facts)
|
|
|
|
|
hardware_facts.update(device_facts)
|
|
|
|
|
hardware_facts.update(mount_facts)
|
|
|
|
|
hardware_facts.update(uptime_facts)
|
|
|
|
|
|
|
|
|
|
return hardware_facts
|
|
|
|
|
|
|
|
|
@ -115,6 +118,15 @@ class OpenBSDHardware(Hardware):
|
|
|
|
|
|
|
|
|
|
return memory_facts
|
|
|
|
|
|
|
|
|
|
def get_uptime_facts(self):
|
|
|
|
|
uptime_facts = {}
|
|
|
|
|
uptime_seconds = self.sysctl['kern.boottime']
|
|
|
|
|
|
|
|
|
|
# uptime = $current_time - $boot_time
|
|
|
|
|
uptime_facts['uptime_seconds'] = int(time.time() - int(uptime_seconds))
|
|
|
|
|
|
|
|
|
|
return uptime_facts
|
|
|
|
|
|
|
|
|
|
def get_processor_facts(self):
|
|
|
|
|
cpu_facts = {}
|
|
|
|
|
processor = []
|
|
|
|
|