Skip to content

Instantly share code, notes, and snippets.

@kevn
Created August 14, 2009 00:57
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 kevn/167562 to your computer and use it in GitHub Desktop.
Save kevn/167562 to your computer and use it in GitHub Desktop.
# File: roles/common.rb
name "common"
description "Applied to all servers"
recipes "users"
default_attributes(
:groups => {
:admins => {:gid => 900},
},
:users => {
:kevn => { :password => "*", :comment => "Kevin", :uid => 1001, :group => :admins },
:bob => { :password => "*", :comment => "Bob", :uid => 1002, :group => :admins },
:joe => { :password => "*", :comment => "Joe", :uid => 1003, :group => :admins },
:al => { :password => "*", :comment => "Al", :uid => 1004, :group => :admins },
},
)
# File: roles/app.rb
name "app"
description "App server"
recipes "merb_site" # Also tried adding "users" here
default_attributes(
:groups => {
:app => {:gid => 800},
},
:users => {
:app => { :password => "*", :comment => "App User", :uid => 800, :group => :app }
}
)
# File: /etc/chef/node.json
{
"run_list": [ "role[common]", "role[app]" ]
}
# File: site-cookbooks/users/recipes/default.rb
raise [node.groups.keys, node.users.keys].inspect
# Results of the raise in the cookbook: [["app"], ["joe", "bob", "kevn", "al"]]
# But I would expect: [["admins", "app"], ["joe", "bob", "kevn", "al", "app"]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment