I was trying to add the %wheel
group to the sudoers
file via chef.
Unfortunately i'm having an hard time to figure out how this cookbook works. The readme doesn't sound very clear to me.
What i have done:
Added
depends 'sudo'
to the metadata file of my recipe
Added the following line at the end of the recipe
node.default['authorization']['sudo']['groups'] = ['wheel']
What happens (the line gets completely ignored):
Recipe: create-user::default
* yum_package[sudo] action install[2016-06-09T19:01:12+01:00] INFO: Processing yum_package[sudo] action install (create-user::default line 9)
(up to date)
* user[edgarsan] action create[2016-06-09T19:01:13+01:00] INFO: Processing user[edgarsan] action create (create-user::default line 14)
(up to date)
* group[wheel] action modify[2016-06-09T19:01:13+01:00] INFO: Processing group[wheel] action modify (create-user::default line 21)
(up to date)
* user[banana] action create[2016-06-09T19:01:13+01:00] INFO: Processing user[banana] action create (create-user::default line 14)
(up to date)
* group[wheel] action modify[2016-06-09T19:01:13+01:00] INFO: Processing group[wheel] action modify (create-user::default line 21)
(up to date)
[2016-06-09T19:01:13+01:00] INFO: Chef Run complete in 3.322762038 seconds
I'm missing something but i'm not finding out what it is from the documentation.
Thanks in advance
You have to also execute the default recipe by adding the following line to your recipe:
include_recipe "sudo"
This will use this attribute here:
template "#{prefix}/sudoers" do
# <snip>
variables(
sudoers_groups: node['authorization']['sudo']['groups'],
# <snip>
)
end