[rudder-users] Class definition

Francois Armand francois.armand at normation.com
Tue Mar 25 11:13:13 CET 2014


On 25/03/2014 02:27, Chris wrote:
> [...]
>>> Another question is how to trigger rules based on the outcome of other
>>> rules.  Perhaps I haven't looked closely enough, but is this possible
>>> out of the box or does that require something custom to glue things
>>> together?
>> Do you have an example of what you need ? I'm not sure I understand what
>> you need here.
> I suppose it would map directly to something like 'classes => if_ok("no_problem")'.
> It would be different than what I explained above because it wouldn't be
> information you would want in inventory, and could change very quickly.
> So a simple example would be restarting a service based on file changes.
> As I understand it, a directive would need built in support to run
> something after a change.  I was wondering if there were a more free form way
> to define dependencies.


OK, I think I see what you want.
I fear that, as you said, you will have to build that logic
intra-technique, and it's typically what we do for restarting a service
when it's config file changed (for ex., see the openssh server
technique). And has technique are (or should be/were thought to be)
closed components, independant from each others, building cooperation
between them is for now ad-hoc, and can be fragile. 

But I believe I can help you nonetheless. As we thought that kind of
things should be simple and built-in, we start ncf ( http://www.ncf.io/
), an abstraction, component-based framework based on CFEngine, and it
is (starting to) be integrated with Rudder.

With ncf, you can do something like that:

    bundle agent ntp {
      methods:
        "package" usebundle  => package_install("ntp");
        "config"  usebundle  => file_from_template("ntp.conf", "/etc/ntp.conf");
        "reload"  usebundle  => service_restart("ntp"),
                  ifvarclass => "file_from_template__etc_ntp_conf_repaired";
        "running" usebundle  => service_ensure_running("ntp");
    }


the class "file_from_template__etc_ntp_conf_repaired" if named by
concention and automatically raised by "file_from_template" when needed.

Is this that kind of thing you want ?

-- 
------------------------------------------------------------------------
*François ARMAND*
/Directeur de la R&D/
Normation <http://www.normation.com>
------------------------------------------------------------------------
*87 rue de Turbigo, 75003 Paris, France*
Telephone: 	+33 (0)1 83 62 99 23
Mobile: 	+33 (0)6 63 37 60 55
------------------------------------------------------------------------

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.rudder-project.org/pipermail/rudder-users/attachments/20140325/d850ff1c/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sig-normation-logo-square.png
Type: image/png
Size: 3503 bytes
Desc: not available
URL: <http://www.rudder-project.org/pipermail/rudder-users/attachments/20140325/d850ff1c/attachment.png>


More information about the rudder-users mailing list