Here my advice:
Try and avoid per-host file anythings. Cfengine provides classes to control
per-host behaviors, trying to simulate that behavior yourself by attempting
to control which files go to which machine undermines Cfengine most powerful
feature - class-based behavioral control. In other words, I recommend you
deploy the same set of configuration files to every machine, and use classes
to control which bodies/bundles get applied to any given machine.
My approach to the bundlesequence is as follows:
# promise.cf
bundlesequence => { @(g.site_seq) } ;
# site.cf
... # lots of "classes" expressions to determine which host we are on
"common_seq" slist => { "some", "common", "bundles" };
web_servers::
"site_seq" slist => { @(common_seq), "php", "apache2" } ;
data_servers::
"site_seq" slist => { @(common_seq), "mysql" } ;
processing_servers::
"site_seq" slist => { @(common_seq), "some_engine" } ;
# using the above, I can easily add a bundle that applies to every server
(common_seq), or one that applies to just a given class of machines.
On Wed, Sep 15, 2010 at 9:03 PM, <[email protected]> wrote:
> Forum: Cfengine Help
> Subject: Looking for ideas on people's config
> Author: hhammer
> Link to topic: https://cfengine.com/forum/read.php?3,18245,18245#msg-18245
>
> Hi,
>
> new to cfengine, I'm using cfengine 3 and I'm trying to understand how to
> best organize things.
>
> Basically, I'd like to minimize the amount of typing and stored
> configuration files. I'd like to have macro groups (eg webservers, desktops,
> etc.) but retaining the possibility of overriding the default configuration
> if a host needs to.
>
> My first attempt was
>
> bundlesequence => { "@(g.commonbundles)", "$(sys.host)" };
>
> the $(sys.host) bundle would be defined in a file called hostname.cf, and
> would include all the relevant promises for the host. This is not optimal as
> it is a lot of work to create and change if I need many host with the same
> configuration (ie, editing n files).
>
> So I tried with a per-host promises.cf, which would include, say
>
> bundlesequence => { "@(g.commonbundles)", "apache", "php", "mysql" };
>
> and then have apache.cf, php,cf, mysql,cf containing the relevant bundles.
> This at least makes the bundles reusable, but still, if I have 100 machines
> like that and I want to change the bundle sequence I have to edit 100 files.
>
> What I'd really need is a sort of "bundle of bundles", so I could say
> (pseudo code, obviously)
>
> bundlesequence => { "@(g.commonbundles)", "webserver_superbundle" };
>
> where "webswerver_superbundle" would be the list of the relevant bundles
> for the webserver.
> Is such a thing possible at all?
>
> Thank you
>
> _______________________________________________
> Help-cfengine mailing list
> [email protected]
> https://cfengine.org/mailman/listinfo/help-cfengine
>
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine