Remove any sysctl settings which are no longer required
authorTom Hughes <tom@compton.nu>
Thu, 13 Feb 2020 19:54:09 +0000 (19:54 +0000)
committerTom Hughes <tom@compton.nu>
Thu, 13 Feb 2020 19:56:15 +0000 (19:56 +0000)
cookbooks/sysctl/recipes/default.rb

index 8cc672eb84207f5ee6ae1e203b9a4a6150e82c6c..bf9860e0cf50bf7d08baec79736cf167af2e14b3 100644 (file)
@@ -31,4 +31,12 @@ if node[:virtualization][:role] != "guest" ||
       end
     end
   end
+
+  Dir.new("/etc/sysctl.d").each_entry do |file|
+    next unless file =~ /^99-chef-(.*)\.conf$/
+
+    sysctl Regexp.last_match(1) do
+      action :remove
+    end
+  end
 end