aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--manifests/base/physical.pp66
-rw-r--r--manifests/subsystem/modprobe/module.pp38
-rw-r--r--manifests/subsystem/sensors.pp56
-rw-r--r--manifests/utils.pp7
4 files changed, 106 insertions, 61 deletions
diff --git a/manifests/base/physical.pp b/manifests/base/physical.pp
index 1eadbe9..035f5c7 100644
--- a/manifests/base/physical.pp
+++ b/manifests/base/physical.pp
@@ -1,73 +1,17 @@
class nodo::base::physical inherits nodo::base::host {
- $smartmontools = lookup('nodo::smartmontools', undef, undef, true)
+ include nodo::subsystem::sensors
- if $smartmontools == true {
- class { 'smartmontools': }
- }
-
- package { [
- 'lm-sensors',
- ]:
- ensure => present,
- }
-
- $downtimed = lookup('nodo::downtimed', undef, undef, 'absent')
-
- # Useful to track downtimes
+ # Downtime monitoring
#
# Check https://tracker.debian.org/pkg/downtimed
# https://packages.debian.org/bookworm/downtimed
# https://dist.epipe.com/downtimed/
+
+ $downtimed = lookup('nodo::downtimed', undef, undef, 'absent')
+
package { [
'downtimed',
]:
ensure => $downtimed,
}
-
- # 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,
- }
- }
-
- # 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).
- $drivetemp = lookup('nodo::drivetemp', undef, undef, 'present')
-
- # Drivetemp: implementation for systems using SysV -- /etc/modules - modules(5)
- file_line { 'etc-modules-drivetemp':
- path => "/etc/modules",
- line => "drivetemp",
- ensure => $drivetemp,
- }
-
- # Drivetemp: implementation using systemd's /etc/modules-load.d/ - modules-load.d(5)
- #
- # 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
- # https://wiki.archlinux.org/title/Kernel_module#Automatic_module_loading
- file { '/etc/modules-load.d/drivetemp.conf':
- ensure => $drivetemp,
- owner => root,
- group => root,
- mode => '0644',
- content => "drivetemp\n",
- }
}
diff --git a/manifests/subsystem/modprobe/module.pp b/manifests/subsystem/modprobe/module.pp
new file mode 100644
index 0000000..21b7398
--- /dev/null
+++ b/manifests/subsystem/modprobe/module.pp
@@ -0,0 +1,38 @@
+#
+# Handles Linux kernel module loading.
+#
+# Module loading is implemented 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
+#
+# In the future, this definition can also manage /etc/modprobe.d/ entries.
+#
+define nodo::subsystem::modprobe::module(
+ $ensure = 'present',
+){
+ # Drivetemp module loading for systems using SysV -- /etc/modules - modules(5)
+ file_line { "etc-modules-${name}":
+ path => "/etc/modules",
+ line => "${name}",
+ ensure => $ensure,
+ }
+
+ # Drivetemp module loading using systemd's /etc/modules-load.d/ - modules-load.d(5)
+ file { "/etc/modules-load.d/${name}.conf":
+ ensure => $ensure,
+ owner => root,
+ group => root,
+ mode => '0644',
+ content => "${name}\n",
+ }
+}
diff --git a/manifests/subsystem/sensors.pp b/manifests/subsystem/sensors.pp
new file mode 100644
index 0000000..8a19831
--- /dev/null
+++ b/manifests/subsystem/sensors.pp
@@ -0,0 +1,56 @@
+class nodo::subsystem::sensors {
+ #
+ # SMART monitoring
+ #
+
+ $smartmontools = lookup('nodo::sensors::smartmontools', undef, undef, 'present')
+
+ if $smartmontools == 'present' {
+ class { 'smartmontools': }
+ }
+
+ #
+ # LM Sensors
+ #
+
+ $lm_sensors = lookup('nodo::sensors::lm_sensors', undef, undef, 'present')
+
+ package { [
+ 'lm-sensors',
+ ]:
+ ensure => $lm_sensors,
+ }
+
+ #
+ # drivetemp
+ #
+ # Just load this driver and lm-sensors will detect sensors automatically.
+ #
+ # 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
+
+ $drivetemp = lookup('nodo::sensors::drivetemp', undef, undef, 'present')
+
+ nodo::subsystem::modprobe::module { 'drivetemp':
+ ensure => $drivetemp,
+ }
+
+ #
+ # 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,
+ }
+ }
+}
diff --git a/manifests/utils.pp b/manifests/utils.pp
index bd8f692..5847438 100644
--- a/manifests/utils.pp
+++ b/manifests/utils.pp
@@ -1,5 +1,12 @@
# Common utilities
class nodo::utils inherits nodo::utils::base {
+ # Ensure every node are ready for offline operation
+ package { [
+ 'apt-offline',
+ ]:
+ ensure => present,
+ }
+
package { [
'pv',
'gcp',