Skip to content

Instantly share code, notes, and snippets.

@macros
Created May 18, 2009 01:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save macros/113260 to your computer and use it in GitHub Desktop.
Save macros/113260 to your computer and use it in GitHub Desktop.
sysctl Mash.new unless attribute?("sysctl")
execute "sysctl" do
command "sysctl -n -e -q -p"
action :nothing
end
template "/etc/sysctl.conf" do
source "sysctl.conf.erb"
mode 0644
owner "root"
group "root"
variables( :sysctl => node[:sysctl] )
notifies :run, resources(:execute => "sysctl")
end
# Managed by chef
<% if @sysctl.length > 0 %>
<% @sysctl.each do |k,v| %>
<%= k %> = <%= v %>
<% end %>
<% end %>
define :sysctl do
key = params[:name]
@node[:sysctl][key] = params[:value]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment