X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/44961f1f6b5a7cd573ebf463ed66f12b5dba226b..9fcfa1aacf134b9db294d03cd9b6ba9a1527f154:/cookbooks/hardware/recipes/default.rb diff --git a/cookbooks/hardware/recipes/default.rb b/cookbooks/hardware/recipes/default.rb index d7c508d9a..d77aebacd 100644 --- a/cookbooks/hardware/recipes/default.rb +++ b/cookbooks/hardware/recipes/default.rb @@ -226,6 +226,10 @@ else end end +watchdog_module = %w[hpwdt sp5100_tco].find do |module_name| + node[:hardware][:pci].any? { |_, pci| pci[:modules]&.any?(module_name) } +end + if node[:kernel][:modules].include?("ipmi_si") package "ipmitool" package "freeipmi-tools" @@ -246,6 +250,8 @@ if node[:kernel][:modules].include?("ipmi_si") options "--config.file=/etc/prometheus/ipmi_local.yml" subscribes :restart, "template[/etc/prometheus/ipmi_local.yml]" end + + watchdog_module ||= "ipmi_watchdog" end package "irqbalance" @@ -609,19 +615,30 @@ node[:hardware][:blacklisted_modules].each do |module_name| end end -if node[:hardware][:watchdog] - package "watchdog" +if watchdog_module + kernel_module watchdog_module do + action :install + end + + execute "systemctl-reload" do + action :nothing + command "systemctl daemon-reload" + user "root" + group "root" + end - template "/etc/default/watchdog" do - source "watchdog.erb" + directory "/etc/systemd/system.conf.d" do owner "root" group "root" - mode "644" - variables :module => node[:hardware][:watchdog] + mode "755" end - service "watchdog" do - action [:enable, :start] + template "/etc/systemd/system.conf.d/watchdog.conf" do + source "watchdog.conf.erb" + owner "root" + group "root" + mode "644" + notifies :run, "execute[systemctl-reload]" end end