Forum: Cfengine Help
Subject: Re: cfengine3 how to organize
Author: bbomgardner
Link to topic: https://cfengine.com/forum/read.php?3,21622,21623#msg-21623

Hey Danny,

I've seen many people recommend (and I have followed) by simply having cf-agent 
read in all cf files on every host.  Unless you have promises that are very 
sensitive in nature it probably is best to keep it simple.

Anyway, this is what I do and it works pretty well.  I picked it up from some 
folks here who are a lot better at this than I am!

In promises.cf, set a common bundlesequence that runs on every host.  For me, 
it is system baseline stuff (like resolv.conf, cron, ntp, nrpe, etc.) that gets 
implemented everywhere.


body common control
{
  bundlesequence      =>      {
                                "blackout",
                                "global",
                                "cf_executor",
                                "cf_server",
                                "cf_tidy",
                                "system_root_crontab",
                                "system_resolver",
                                "system_ntp",
                                "system_repos",
                                "system_tools",
                                "system_workarounds",
                                "app_mail_mta",
                                "app_mail_aliases",
                                "app_monitor_nrpe",
                                "app_monitor_syslog",
                                "app_backup_dp",
                                  ..........
                                "machine_specific"
                              };

  inputs              =>      {
                                "cf-execd.cf",
                                "cf-execd.cf",
                                "cf-serverd.cf",
                                "cf-agent.cf",
                                "cf-monitord.cf",
                                "cf-report.cf",
                                "cfengine_stdlib.cf",
                                "local_stdlib.cf",
                                "system.cf",
                                "app_monitor.cf",
                                "app_mail.cf",
                                    .......
                               }


The last bundle after the baseline promises have run, is a 'machine specific' 
bundle that has nothing but module promises, which then ask cf-agent to execute 
other bundles based on class (which I defined in the bundle common global):


bundle agent machine_specific
{
vars:

  "app_web_seq" slist   =>  {
                                "app_web_packages",
                                "app_web_jdk",
                                "app_web_tomcat",
                                "app_web_apache",
                                "app_web_pureftpd",
                                "app_web_cselector"
                              };

methods:

  web_servers::
    "any" usebundle     =>    "$(app_web_seq)";
}



As you can see, methods are also a good way to order promises bundles if you 
need to.

I'd also recommend taking a look at the best practice doc in the Engine Room as 
well.  This helped me a lot.

_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to