I am trying to run a recipe in a loop, passing a different attribute value to that recipe on each iteration of the loop. But it looks like if include a recipe 1 time, it is always included and it maintains the state of the initial load. So I want to know how I can remove/unload the recipe from the run so I can include it again?
EXAMPLE:
default[‘example’][‘attribute’][‘combinedversion’]. = [‘6.2’, ‘7.2’, ‘7.4’]
node['example']['attribute']['combinedversion'].each do | version |
node.override['example']['attribute']['version'] = version
include_recipe 'mycookbook::my_recipe'
end
looks like there was a way by using the run_state, but not sure how it will work now that the :seen_recipes is deprecated.
I can list the recipes, that have been loaded like:
ruby_block "run_state" do
block do
run_context.loaded_recipes.each do | x |
puts x
end
end
end
Now how can I remove one that is listed???
Thank You!!