Forum: CFEngine Help
Subject: Re: Bootstrapping / Files copied
Author: sauer
Link to topic: https://cfengine.com/forum/read.php?3,27314,27620#msg-27620
tjavo87 Wrote:
-------------------------------------------------------
> I'm interested how you've build the cfengine
> configuration.. Would you be so kind to share some
> more information please?
My promises.cf looks similar to
body common control {
inputs => {
@(define_includes.include),
};
bundlesequence => {
@(define_includes.sequence),
};
version => "current release";
ignore_missing_inputs => "true";
ignore_missing_bundles => "true";
}
bundle common server_types {
vars:
any::
"serverlist_cf_test" slist => {
"server1",
"server2",
};
classes:
"has_hostsrc"
expression => fileexists( "$(sys.workdir)/inputs/perhost/hostsrc.cf" );
"has_rootpass"
expression => fileexists( "$(sys.workdir)/inputs/perhost/rootpass.cf" );
"servertype_cfengine"
or => { srv_any };
"servertype_testsystem"
expression => classmatch("[[:alpha:]]{2}95\w+");
}
bundle common define_includes {
vars:
any::
"i" int => "1";
"i" int => "1";
"s" int => "1";
"s" int => "1";
##########
agent::
"i" int => "1";
executor::
"i" int => "1";
# template for adding a new file :)
!any::
"i" int => "1";
"s" int => "1";
agent::
"i" int => "1";
"s" int => "1";
servertype_cfengine::
"s" int => "1";
agent&(aix|linux)::
"i" int => "1";
"s" int => "1";
agent&has_hostsrc::
"i" int => "1";
"s" int => "1";
!FROM_CRON::
"include" slist => getindices( "i" );
"sequence" slist => getindices( "s" );
}
Much of that's been trimmed out (there's several thousand lines of code in
there which is all machine-generated, among others). But I think the point is
made. I define some variables and classes in server_types, and then use those
classes (and some hard classes) to build an array of included files + bundle
sequence entities. The important part to remember is that promises.cf is
passed over once, top-down, before the includes are handled.
The host-specific part is handled in update.cf, where I define the perhost
source to $(base)/perhost/$(sys.uqhost)". Then each machine pulls down its
"perhost" to the same local directory, and each system's perhost directory may
or may not contain a hostsrc.cf (which changes the update path), a rootpass.cf
(sets the root account's password), etc. If it exists, then extra stuff's
added in to the processing. If not, it's left out. I intend to expand this a
little in the future to make it so that update.cf only downloads the files
which are going to be used (mostly relevant to applications that have template
files, unpackaged installers, ssl certificates, etc), but haven't gotten to
that point yet.
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine