Chef LWRP for parsing templates recursively in a directory and automatically populating your variables hash from a hash attribute
You must add naruto to your metadata.rb
Populate an attribute with a hash to use as your variable keys (names) and values
You can add common values to get parsed into all templates
node.set['mycookbook']['myapp']['db_host'] = 'host1'
node.set['mycookbook']['myapp']['db_user'] = 'user1'
node.set['mycookbook']['myapp']['db_pass'] = 'greatpassword'
node.set['mycookbook']['myapp']['db_name'] = 'awesomedb'
Add app or template specific values to only be parsed into certain templates
node.set['mycookbook']['common']['log_dir'] = '/var/log'
node.set['mycookbook']['common']['tmp_dir'] = '/tmp'
myapp_variables = {}
myapp_variables = node['mycookbook']['common'].to_hash.merge(node['mycookbook']['myapp'].to_hash)
naruto_recursive_parse 'myapp_templates' do
action :create
base_dir "/opt/myapp"
variables myapp_variables
notifies :restart, 'service[myapp]'
end
This allows you to ignore files or patterns matched in a file name. It is a regex and will match your entry anywhere in the file's path or name.
ignore_file ["file.one", "otherfile.two"]