Forum: CFEngine Help Subject: Re: About "new" templates correct usage or limitations Author: th Link to topic: https://cfengine.com/forum/read.php?3,26723,26826#msg-26826
zzamboni Wrote: ------------------------------------------------------- > One way to ensure contents of the entire file and > still be able to make surgical changes would be to > use a 3-step staged approach Hello, Indeed, I thought about a similar approach : let's say I want to install/repair the main.cf postfix config file. I thought I could : - copy a main.cf.tmpl template file (which would embed variables to be expanded according to class expressions stated in the .cf file) - expand this template via expand_template into the non-existing main.cf.tmp file (thus fast expand since no check for already existing file) - maybe check and delete if it's still around. - rename main.cf.tmp (via a CFEngine promise of course) to main.cf Another way I imagined was : - copy main.cf to main.cf.tmp - make the chirugical edits in the same way as your sshd_config example - rename main.cf.tmp to main.cf Is that was you are describing ? Another way of seeing things is that using templates is not such a good idea because it's not very flexible. You may want to merge local non CFEngine managed edits with some policy CFEngine enforced values. With templates you lose this possibility... Thanks for you help. -- TH _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine