Hi Arne
I get from your question that you are using exclusively the
bundlesequence to decide what bundles should run. However, for your case
is kind of suboptimal and Sean has already suggested a different
solution (autorun). There is some info on
cfengine.com itself:
https://cfengine.com/company/blog-detail/dynamic-bundlesequence-with-autorun-meta-tags-and-hard-classes/
Another solution would be dynamic bundles, the ancestor of autorun. Neil
Watson wrote about that in 2011:
http://watson-wilson.ca/blog/2011/09/16/cfengine-dynamic-bundlesequence/
What I usually do is to call a very few bundles from the bundlesequence,
and have a "main" bundle which contains primarily methods promises,
where each of them (or small groups of them) are conditioned by classes,
e.g.:
bundle agent main
{
methods:
class_condition_1::
"do this"
usebundle => this_bundle ;
class_condition_2::
"do that"
usebundle => that_bundle ;
...and so on and so forth.
For setting classes dynamically, depending on a number of different
conditions, I use hENC:
https://github.com/brontolinux/hENC
hENC allows you to set classes and variables by reading one or more of
files, where the list of files to be read is built dynamically inside
the policies, hence adapting the execution of the policy to the
particular system. Where two files contain conflicting settings (e.g. a
variable is set to 1 in the first file and to 5 in another one), the
last file wins.
So you have plenty of solutions depending on how complex is the problem
you are trying to solve. Pick up the one that fits you best and... Good
luck ;-)
Ciao
-- bronto