Skip to content
Create a gist now

Instantly share code, notes, and snippets.

sysctl unless attribute?("sysctl")
execute "sysctl" do
command "sysctl -n -e -q -p"
action :nothing
template "/etc/sysctl.conf" do
source "sysctl.conf.erb"
mode 0644
owner "root"
group "root"
variables( :sysctl => node[:sysctl] )
notifies :run, resources(:execute => "sysctl")
# 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]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.