From df083ed13f74574e55a679e7748cc3e937821cda Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Mon, 8 Nov 2021 10:57:15 +0000 Subject: [PATCH] Modernise force loading of modules --- cookbooks/hardware/recipes/default.rb | 14 ++++++-------- cookbooks/hardware/templates/default/modules.erb | 5 ----- 2 files changed, 6 insertions(+), 13 deletions(-) delete mode 100644 cookbooks/hardware/templates/default/modules.erb diff --git a/cookbooks/hardware/recipes/default.rb b/cookbooks/hardware/recipes/default.rb index 88bb45613..633edcb19 100644 --- a/cookbooks/hardware/recipes/default.rb +++ b/cookbooks/hardware/recipes/default.rb @@ -540,16 +540,14 @@ if File.exist?("/etc/mdadm/mdadm.conf") end end -template "/etc/modules" do - source "modules.erb" - owner "root" - group "root" - mode "644" +file "/etc/modules" do + action :delete end -service "systemd-modules-load" do - action :nothing - subscribes :restart, "template[/etc/modules]" +node[:hardware][:modules].each do |module_name| + kernel_module module_name do + action :install + end end if node[:hardware][:watchdog] diff --git a/cookbooks/hardware/templates/default/modules.erb b/cookbooks/hardware/templates/default/modules.erb deleted file mode 100644 index 9ba59d26d..000000000 --- a/cookbooks/hardware/templates/default/modules.erb +++ /dev/null @@ -1,5 +0,0 @@ -# DO NOT EDIT - This file is being maintained by Chef - -<% node[:hardware][:modules].each do |m| -%> -<%= m %> -<% end -%> -- 2.39.5