aboutsummaryrefslogtreecommitdiff
path: root/manifests/subsystem
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2024-07-05 12:25:32 -0300
committerSilvio Rhatto <rhatto@riseup.net>2024-07-05 12:25:32 -0300
commit496fed357d75ec33a2841ca9244590d6aa9412a0 (patch)
tree5ff1cfe0f3f2245fc72826ca94d814b24ef4d752 /manifests/subsystem
parent2d9347f596d6f3c191a99ca29e8085e2000759c3 (diff)
downloadpuppet-nodo-496fed357d75ec33a2841ca9244590d6aa9412a0.tar.gz
puppet-nodo-496fed357d75ec33a2841ca9244590d6aa9412a0.tar.bz2
Feat: adds nodo::subsystem::sensors
Diffstat (limited to 'manifests/subsystem')
-rw-r--r--manifests/subsystem/sensors.pp81
1 files changed, 81 insertions, 0 deletions
diff --git a/manifests/subsystem/sensors.pp b/manifests/subsystem/sensors.pp
new file mode 100644
index 0000000..caa99ef
--- /dev/null
+++ b/manifests/subsystem/sensors.pp
@@ -0,0 +1,81 @@
+class nodo::subsystem::sensors {
+ #
+ # SMART monitoring
+ #
+
+ $smartmontools = lookup('nodo::smartmontools', undef, undef, true)
+
+ if $smartmontools == true {
+ class { 'smartmontools': }
+ }
+
+ #
+ # LM Sensors
+ #
+
+ package { [
+ 'lm-sensors',
+ ]:
+ ensure => present,
+ }
+
+ #
+ # hddtemp
+ #
+
+ # Deprecated in favor of drivetemp
+ # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1002484
+ package { [
+ 'hddtemp',
+ ]:
+ ensure => $::lsbdistcodename ? {
+ 'wheezy' => present,
+ 'buster' => present,
+ 'bullseye' => present,
+ default => absent,
+ }
+ }
+
+ #
+ # drivetemp
+ #
+ # References: https://www.baeldung.com/linux/hdd-ssd-temperature
+ # https://askubuntu.com/questions/1426482/tool-to-monitor-hdd-temperature-in-ubuntu-server-22-04
+ # https://wiki.archlinux.org/title/Lm_sensors#S.M.A.R.T._drive_temperature
+ # https://github.com/philipl/drivetemp
+ #
+ # We'll implement drive temp module loading both for SysV and systemd based
+ # systems, to ensure this module is managed in either case.
+ #
+ # It also remains to be tested whether _both_ /etc/modules and /etc/modules-load.d
+ # are processed by recent systemd-based Debian systems; or if there are
+ # inconsistencies between the implementation and the documentation:
+ #
+ # https://wiki.debian.org/Modules#Automatic_loading_of_modules
+ #
+ # Anyway, having this configuration in both places does not seem to hurt (much).
+ #
+ # Check also https://wiki.archlinux.org/title/Kernel_module#Automatic_module_loading
+ # https://unix.stackexchange.com/questions/189670/whats-the-difference-of-etc-modules-load-d-and-etc-modules
+ #
+ # FIXME: this logic should be moved to a nodo::subsystem::modprobe::module definition.
+ #
+
+ $drivetemp = lookup('nodo::drivetemp', undef, undef, 'present')
+
+ # Drivetemp module loading for systems using SysV -- /etc/modules - modules(5)
+ file_line { 'etc-modules-drivetemp':
+ path => "/etc/modules",
+ line => "drivetemp",
+ ensure => $drivetemp,
+ }
+
+ # Drivetemp module loading using systemd's /etc/modules-load.d/ - modules-load.d(5)
+ file { '/etc/modules-load.d/drivetemp.conf':
+ ensure => $drivetemp,
+ owner => root,
+ group => root,
+ mode => '0644',
+ content => "drivetemp\n",
+ }
+}