Forum: Cfengine Help
Subject: Re: cfengine-3; controlling Redhat/CentOS "chkconfig"
Author: neilhwatson
Link to topic: https://cfengine.com/forum/read.php?3,20843,20845#msg-20845



       vars:
            unxxhd01::
            "services" slist => {
                "xfs",
                "smb",
                "autofs",
                "xinetd"


        methods:

            redhat|SuSE::

            "any" usebundle => rh_chkconfig_status(${services});
}

bundle agent rh_chkconfig_status(s){
# Report whether service is enabled using chkconfig

    classes:
    
        "${s}_enabled" expression =>
             returnszero("/sbin/chkconfig ${s}","noshell");

    reports:

        all::
            "${g.pf} Service ${s} is enabled",
            ifvarclass => "${s}_enabled";

            "${g.pk} Service ${s} is not enabled",
            ifvarclass => "!${s}_enabled";
}



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

Reply via email to