Skip to content

Instantly share code, notes, and snippets.

@jsierles
Created July 23, 2009 17:03
Show Gist options
  • Select an option

  • Save jsierles/153236 to your computer and use it in GitHub Desktop.

Select an option

Save jsierles/153236 to your computer and use it in GitHub Desktop.
# users recipe
node[:active_groups].each do |group_name, config|
users = node[:users].find_all { |u| u.last[:group] == group_name }
group group_name.to_s do
group = node[:groups][group_name]
gid group[:gid]
# TODO: add users to groups under their role
#members node[:groups]
end
users.each do |u, config|
user u do
comment config[:comment]
uid config[:uid]
gid config[:group].to_s
home "/home/#{u}"
shell "/bin/bash"
password config[:password]
supports :manage_home => true
action [:create, :manage]
end
end
# base role file
name "base"
override_attributes :groups => {:app => {:gid => 1001}},
:users => {:app => {:password => "$111111111111111111111111", :comment => "App User", :uid => 1001, :group => :app}
recipes "users"
# specific role file
name "utility"
override_attributes :active_groups => {:app => {:enabled => true}}
# utility server json file
{"run_list": "role[base]", "role[utility]"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment