Sha256: feb3b9eba84e2601cecc96ecbb93d2eb5e28137d83c2e4e86181cae6b549d92b
Contents?: true
Size: 1.53 KB
Versions: 1
Compression:
Stored size: 1.53 KB
Contents
# # Cookbook Name:: user # Recipe:: data_bag # # Copyright 2011, Fletcher Nichol # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # bag = node['user']['data_bag_name'] # Fetch the user array from the node's attribute hash. If a subhash is # desired (ex. node['base']['user_accounts']), then set: # # node['user']['user_array_node_attr'] = "base/user_accounts" user_array = node node['user']['user_array_node_attr'].split("/").each do |hash_key| user_array = user_array.send(:[], hash_key) end # only manage the subset of users defined Array(user_array).each do |i| u = data_bag_item(bag, i.gsub(/[.]/, '-')) username = u['username'] || u['id'] user_account username do %w{comment uid gid home shell password system_user manage_home create_group ssh_keys ssh_keygen}.each do |attr| send(attr, u[attr]) if u[attr] end action u['action'].to_sym if u['action'] end unless u['groups'].nil? u['groups'].each do |groupname| group groupname do members username append true end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
blinkenstein-0.1.1 | chef/cookbooks/user/recipes/data_bag.rb |