Skip to content

Instantly share code, notes, and snippets.

@ahendrix
Forked from mikehale/kernel_module.rb
Last active August 29, 2015 13:57
Show Gist options
  • Save ahendrix/9396937 to your computer and use it in GitHub Desktop.
Save ahendrix/9396937 to your computer and use it in GitHub Desktop.
# A chef definition for installing kernel modules on ubuntu/debian.
define :kernel_module, :action => :install do
if params[:action] == :install
bash "modprobe #{params[:name]}" do
code "modprobe #{params[:name]}"
not_if "lsmod |grep #{params[:name]}"
end
bash "install #{params[:name]} in /etc/modules" do
code "echo '#{params[:name]}' >> /etc/modules"
not_if "grep '^#{params[:name]}$' /etc/modules"
# TODO: assert that /var/run/reboot-required contains a string
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment