Reputation: 13
In chef you can call a recipe by using string variables like
cookbook='my_cookbook'
%w[ recipe1 recipe2 recipe3 ].each do |recipe|
include_recipe "#{cookbook}::#{recipe}"
end
Is it possible to do a similar thing to execute different custom resources?
Upvotes: 0
Views: 157
Reputation: 54181
I probably wouldn't actually use a loop for this but:
%w{one two three}.each do |res|
declare_resource(:"mycookbook_#{res}", "nameofresource") do
# Normal resource body block goes here.
end
end
If you can be more specific about the use case, I can try to give you a better example of what to actually use instead.
Upvotes: 1