]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/sysctl/recipes/default.rb
tile: use osm2pgsql-replication promethus
[chef.git] / cookbooks / sysctl / recipes / default.rb
index 8cc672eb84207f5ee6ae1e203b9a4a6150e82c6c..f16537c5185c277d12897f8424bf8b6cf58575d9 100644 (file)
@@ -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