Skip to content

Instantly share code, notes, and snippets.

@adamhjk
Created October 20, 2009 17:43
Show Gist options
  • Select an option

  • Save adamhjk/214452 to your computer and use it in GitHub Desktop.

Select an option

Save adamhjk/214452 to your computer and use it in GitHub Desktop.
define :sudo_user, :username => nil do
begin
r = resource(:template => "/etc/sudoers")
rescue
r = template "/etc/sudoers" do
source "sudoers.erb"
attributes { :users => [], :groups => [] }
end
end
r.attributes[:users] << params[:username]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment