X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/39655efd0b4e600577ca20b97311702da766de40..a6a40aaf96f0620bf8f4a6e9f01b44ff25d8307b:/cookbooks/sysctl/recipes/default.rb diff --git a/cookbooks/sysctl/recipes/default.rb b/cookbooks/sysctl/recipes/default.rb index 8cc672eb8..f16537c51 100644 --- a/cookbooks/sysctl/recipes/default.rb +++ b/cookbooks/sysctl/recipes/default.rb @@ -22,13 +22,31 @@ file "/etc/sysctl.d/60-chef.conf" do end if node[:virtualization][:role] != "guest" || - node[:virtualization][:system] != "lxd" + (node[:virtualization][:system] != "lxc" && + node[:virtualization][:system] != "lxd" && + node[:virtualization][:system] != "openvz") + 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] end + + keys.delete(key) + end + end + + keys.each do |key| + sysctl key do + action :remove end end end