Forum: CFEngine Help
Subject: Re: CFEngine Help: Re: controlling redhat-style startup services via 
chkconfig
Author: neilhwatson
Link to topic: https://cfengine.com/forum/read.php?3,24170,24175#msg-24175

Not tested.


bundle common g {

        classes:

                "dns_servers" or => { "ipv4_10.0.0.1", "ipv4_10.0.0.2" };

                "web_servers" or => { "www1", "www2", "www3" };

}

bundle agent main {

        vars:

                dns_servers::
                        "services" slist => { "named", "ntpd" }, policy => 
"free";
                        "packages" slist => { "bind9", "ntpd" }, policy => 
"free";

                web_servers::
                        "services" slist => { "httpd", "ntpd" }, policy => 
"free";
                        "packages" slist => { "apache2", "ntpd" }, policy => 
"free";

                any::  # Default to this

                        "services" slist => { "ntpd" }, policy => "free";
                        "packages" slist => { "vim", "ntpd" }, policy => "free";

        methods:

                "install" usebundle => yum_install("@(main.packages)");
                "enable" usebundle => rh_svc_enable("@(main.services)");
        
}


Someone thinking like a programmer will likely want to make this more 
efficient.  It might be possible but at the expense of readability and 
understanding for the reader with very little performance gain.

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

Reply via email to