Forum: Cfengine Help Subject: Re: I'm exploiting usemodule. There has got to be a better way to define global classes? Author: Seva Gluschenko Link to topic: https://cfengine.com/forum/read.php?3,18623,18652#msg-18652
Well, actually, my approach differs a bit. First, my servers are grouped into certain roles, and that grouping is reflected in our internal management databases. Since the community edition of Cfengine does not provide any database connectors, I'm using a Perl script which updates groups list on a regular basis (well, it's called via Cfengine itself on the policy host). The script writes groups.cf file which is nothing else as bundle common grp { classes: "webserver" or => { "serverX", "serverY" }; ... } The body common control then utilises those classes definitions to alter bunldesequence. Accordingly, my promises are packed into more or less self contained bundles which initially accept just "on" or "off" as their runtime argument, so typically it looks like body common control { webserver:: bundlesequence => { @(g.bstrap), apache("on"), iptables("on"), mysql("off") }; database:: bundlesequence => { @(g.bstrap), apache("off"), iptables("off"), mysql("on") }; } Using such an approach, servers can be moved from group to group by simplest change in groups configuration, so that Cfengine takes care about all the rest. Of course, in generic database servers aren't interchangeable with webservers due to hardware specifics, but there are indeed groups, which allow such movements. _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine