aboutsummaryrefslogtreecommitdiff
path: root/manifests/base/physical.pp
blob: 1eadbe97561b89d69bf4d2c9fa93790f4999e40e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
class nodo::base::physical inherits nodo::base::host {
  $smartmontools = lookup('nodo::smartmontools', undef, undef, true)

  if $smartmontools == true {
    class { 'smartmontools': }
  }

  package { [
    'lm-sensors',
  ]:
    ensure => present,
  }

  $downtimed = lookup('nodo::downtimed', undef, undef, 'absent')

  # Useful to track downtimes
  #
  # Check https://tracker.debian.org/pkg/downtimed
  #       https://packages.debian.org/bookworm/downtimed
  #       https://dist.epipe.com/downtimed/
  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",
  }
}