In previous chapters we have seen a number of CFEngine policies to achieve different specific tasks, with the intention of introducing you to a number of basic CFEngine concepts. Now that you know those basic concepts, I would like to introduce you to several generic techniques and patterns that are generally useful when writing CFEngine policies. Mastering these techniques will help you write more concise and efficient CFEngine code.
One of the common uses of CFEngine is to copy files (configuration
files, binaries, libraries, documentation, etc.) into systems. If you
maintain a heterogeneous network consisting of different system types,
operating systems, architectures, and applications, you will at some point
need to copy different sets of files onto different systems. The most
straightforward way of achieving this would be to have different promises
files: section for different hard
classes that reflect the different system categories you want to
differentiate. For example, you may want to copy different /etc/hosts files depending on the operating
This example can be easily simplified if you know that the built-in
$(sys.flavor) contains ...