Skip to content

Instantly share code, notes, and snippets.

@zzondlo
Forked from adamhjk/sample_define.rb
Created April 3, 2012 01:29
Show Gist options
  • Select an option

  • Save zzondlo/2288596 to your computer and use it in GitHub Desktop.

Select an option

Save zzondlo/2288596 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