- From: Yoshi Spendiff <
>
- To: chef <
>
- Subject: [chef] Re: Creating local users
- Date: Thu, 30 Jul 2015 08:16:08 -0700
I have a base cookbook with a users recipe that I apply to all nodes.
It looks something like this:
node['base-cookbook']['users'].each do |username, enabled|
user username do
action enabled ? :create : :remove
<other user options>
end
end
Then in your roles or role cookbook you can just use that attribute.
default['base-cookbook']['users']['user_1'] = true
default['base-cookbook']['users']['user_2'] = true
default['base-cookbook']['users']['user_3'] = false
I use a hash instead of an array so you can delete a user and so you don't come across any situations where you were expecting to overwrite an array and instead it was merged.
Archive powered by MHonArc 2.6.16.