Forum: CFEngine Help Subject: Re: About "new" templates correct usage or limitations Author: zzamboni Link to topic: https://cfengine.com/forum/read.php?3,26723,26816#msg-26816
As Neil said, there's no "one true way" of doing things, since all systems are different. 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 (I think this has been described by Mike Svoboda somewhere in this forum, but can't find it). Essentially works like this: 1. Copy "master file" from its master location to /local/template/file. CFEngine will only re-copy the file if the master file has changed. 2. Apply transforms on /local/template/file, using edit_line or whatever you want, to produce /local/staging/file. CFEngine will only re-write /local/staging/file if, after the edits, it's different from what it was before. 3. Copy /local/staging/file to /final/file. CFEngine will only re-copy the file if it has changed. This has the advantage that at each step, actions are performed on the system only if there have been changes. And for the second step you can use plain edit_line promises (as shown in the sshd example on my book), edit_template, expand_scalars, or whatever mechanism you want. Best regards, _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine