X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/cb646590a622f93f6eb78f5b6d8a0cfbb0e23ab2..ae7c3c728ad4b1a4a1c71715a43e1f0d44a5289b:/cookbooks/sysctl/recipes/default.rb diff --git a/cookbooks/sysctl/recipes/default.rb b/cookbooks/sysctl/recipes/default.rb index 0190b37b7..a2facc063 100644 --- a/cookbooks/sysctl/recipes/default.rb +++ b/cookbooks/sysctl/recipes/default.rb @@ -23,12 +23,28 @@ end if node[:virtualization][:role] != "guest" || node[:virtualization][:system] != "lxd" + keys = [] + + Dir.new("/etc/sysctl.d").each_entry do |file| + next unless file =~ /^99-chef-(.*)\.conf$/ + + keys.push(Regexp.last_match(1)) + end + node[:sysctl].each_value do |group| group[:parameters].each do |key, value| sysctl key do value value - comment group[:comment] + # comment group[:comment] end + + keys.delete(key) + end + end + + keys.each do |key| + sysctl key do + action :remove end end end