aboutsummaryrefslogtreecommitdiff
path: root/manifests/subsystem/sysctl/panic.pp
blob: 45019375b6b2929c6821c67a641681b121d0e3c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
class nodo::subsystem::sysctl::panic($seconds = lookup('nodo::sysctl::panic', undef, undef, '20')) {
  # See https://www.systutorials.com/how-to-make-linux-automatically-reboot-after-a-kernel-panic/
  #     https://unix.stackexchange.com/questions/29567/how-to-early-configure-linux-kernel-to-reboot-on-panic
  #     https://sysctl-explorer.net/kernel/panic/
  file { "/etc/sysctl.d/kernel.panic.conf":
    owner   => "root",
    group   => "root",
    mode    => '0644',
    ensure  => present,
    content => "kernel.panic = ${seconds}\n",
  }

  exec { "/bin/echo '${seconds}' > /proc/sys/kernel/panic":
    subscribe   => File["/etc/sysctl.d/kernel.panic.conf"],
    refreshonly => true,
  }
}