]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/sysctl/recipes/default.rb
Disable sysctl comments for now
[chef.git] / cookbooks / sysctl / recipes / default.rb
index 44562a7baf515e0343a66f48a927bfa01e2166c5..8cc672eb84207f5ee6ae1e203b9a4a6150e82c6c 100644 (file)
@@ -1,8 +1,8 @@
 #
-# Cookbook Name:: sysctl
+# Cookbook:: sysctl
 # Recipe:: default
 #
-# Copyright 2010, Tom Hughes
+# Copyright:: 2010, Tom Hughes
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # limitations under the License.
 #
 
-package "procps"
-
-directory "/etc/sysctl.d" do
-  owner "root"
-  group "root"
-  mode 0o755
-end
-
-execute "sysctl" do
-  action :nothing
-  command "/sbin/sysctl -p /etc/sysctl.d/60-chef.conf"
+file "/etc/sysctl.d/60-chef.conf" do
+  action :delete
 end
 
-template "/etc/sysctl.d/60-chef.conf" do
-  source "chef.conf.erb"
-  owner "root"
-  group "root"
-  mode 0o644
-  notifies :run, "execute[sysctl]"
-end
-
-node[:sysctl].each_value do |group|
-  group[:parameters].each do |key, value|
-    sysctl_file = "/proc/sys/#{key.tr('.', '/')}"
-
-    file sysctl_file do
-      content "#{value}\n"
-      atomic_update false
-      only_if { File.exist?(sysctl_file) }
+if node[:virtualization][:role] != "guest" ||
+   node[:virtualization][:system] != "lxd"
+  node[:sysctl].each_value do |group|
+    group[:parameters].each do |key, value|
+      sysctl key do
+        value value
+        # comment group[:comment]
+      end
     end
   end
 end