But i cant find any situation in which i can say things like this.
If you have any idea they will be welcome!
You can define a recipe which invokes include_recipe conditionally, thereby
affecting the execution order, if that’s truly all you need. But there are
two things to watch out for:
If the same recipe is included multiple times, only the first inclusion
will be processed.
The evaluation of recipes in Chef is done in the preprocessing stage, so
it won’t have access to
values produced during subsequent resource processing.
If your algorithm needs to access dynamic values, you have to implement it
in a resource such as ruby_block or in custom resources that you define.
The Chef DSL is essentially a macro expansion, so any control structure such
as conditionals or iteration in the recipes will be expanded to produce
static text, which is then evaluated in the ordinary manner.
On 14-06-10 10:51 AM, Carlos Camacho wrote:
Perfect, now ill try to change the answer.
Im modeling SPL’s as part of my PhD course. Now i really like Chef and
i wish to be able to model a condition in which the execution order of
a Chef process (Calculating the recipes run list for example) can
vary. If a i execute A firt then B or B first and then A.
Any idea? It will be an example of how to apply a formal semantics to
calculate the best product. Im assuming that Chef is a SPL which
generates valid configurations (Products) to be installed on a node.
On Tue, Jun 10, 2014 at 12:22 PM, Noah Kantrowitz email@example.com
Recipes and roles that you actually put in a run list should be
self-contained. This means that they should both be order-independent and
idempotent, so it shouldn’t matter either way.
On Jun 10, 2014, at 2:51 AM, Carlos Camacho firstname.lastname@example.org
But in my case I’m trying to model something in chef in which the
order of cookbooks or recipes can vary.
DB and WEB roles.
Apache and MySQL cookbooks.
A set of recipes for each cookbook.
Now i want to create a node within the DB and WEB roles.
I want to know if there are cases in which is better to apply the WEB
then the DB roles recipes or DB first and then WEB.
Any idea of situations like this? In which the order of the execution
can improve the system behavior (For example, the execution time for
all recipes, or roles, or environments)?
On Tue, Jun 10, 2014 at 11:16 AM, Noah Kantrowitz email@example.com
On Jun 10, 2014, at 1:18 AM, Carlos Camacho firstname.lastname@example.org
I’m trying to do some research on how evaluate chef recipes when they
I have a lot of recipes inside my Apache2 cookbook.
Is there a way to establish a weight for the recipes order??..
A) default.rb -> god_monitor.rb -> iptables.rb -> logrotate.rb = 2.3
B) default.rb -> iptables.rb -> god_monitor.rb -> logrotate.rb = 3.6
C) logrotate.rb -> default.rb -> god_monitor.rb -> iptables.rb = 1
D) default.rb -> god_monitor.rb -> iptables.rb -> logrotate.rb = 6.1
In this case is better to execute D than, B than, A than C.
Recipes execute in the order you tell them to. First the run list is
recursively expanded so roles are replaced by their run list until you just
have a list of recipes. Then each is executed in order. If, while executing,
it hits an include_recipe, then it executes that recipe at that point. All
other file types where it loads all of them are executed is ASCII sort