Skip to content

Instantly share code, notes, and snippets.

@bryanwb
Created October 16, 2011 06:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bryanwb/1290581 to your computer and use it in GitHub Desktop.
Save bryanwb/1290581 to your computer and use it in GitHub Desktop.
Example of a sudoers template with chef
# /etc/sudoers
#
# Generated by Chef for <%= node[:fqdn] %>
Defaults !lecture,tty_tickets,!fqdn
# User privilege specification
root ALL=(ALL) ALL
<% @sudoers_users.each do |user| -%>
<%= user %> ALL=(ALL) <%= "NOPASSWD:" if @passwordless %>ALL
<% end -%>
# Members of the sysadmin group may gain root privileges
%sysadmin ALL=(ALL) <%= "NOPASSWD:" if @passwordless %>ALL
<% @sudoers_groups.each do |group| -%>
# Members of the group '<%= group %>' may gain root privileges
%<%= group %> ALL=(ALL) <%= "NOPASSWD:" if @passwordless %>ALL
<% end -%>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment