Forum: CFEngine Help
Subject: Re: CFEngine Help: Re: "real" templates
Author: sauer
Link to topic: https://cfengine.com/forum/read.php?3,23837,23863#msg-23863

I took a Puppet class a couple of months ago (don't ask), and that stuff will 
rot your brain. Forget how Puppet works, and this stuff will probably come 
easier. ;)  In particular, keeping all of the logic inside the policy instead 
of spreading it all over the place makes for a way more logical config.  But 
specifically on-topic...

It sounds like your rules boil down to:
"insert this multi-line header at the top"
"insert several lines based on conditions which could be defined as classes"

you basically have just a few classes needed:
is_unicast_ntp_server
is_multicast_ntp_server
is_multicast_ntp_client
is_unicast_ntp_client

Then everything else is just an edit line promise, using key=value form.  
Define your header as a scalar, do your edits with the empty_file rule, and 
rebuild the file from the ground up.  You don't even need a template for that.  
Most ntp configurations I'm aware of don't have any kind of order neccesary.  
Even the peers don't matter, since ntp will figure out which peer is the best 
by itself.

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

Reply via email to