we're using puppet pretty heavily here and one pattern we have is some global variables that are used to manage whether we setup monitoring within a particular class, or say manage iptables rules. Im trying to get away from using global variables to drive this and move it towards using hiera, but wanted a simple api in the code.
So I'm looking at writing a "feature_flags" class (well mostly just a function) to provide a quick lookup into a hiera hash.
eg
if (feature::is_enabled("monitoring")) {
// create exported resources for monitoring
}
My understanding is that class scoped variables wont be visible until the class in included, so the order of inclusion really breaks this model (or you end up "include-ing" the class before every call).