Syntax of the Techniques


The Techniques use the StringTemplate engine. A Technique must have the .st extension to be extended by Rudder (have some variables replaced, some part removed or added given some parameters).

Variable remplacement

Note : Rudder use a StringTemplate grammar slighlty different from the default one. Rather than using "$" as a variable identifier, the Techniques use "&" to avoid collision with the CFEngine variables

Single-valued variable remplacement

  • Will be remplaced by the value of the variable UUID

Remplacement of variable with one or more values

&DNS_RESOLVERS: { "&it&" };separator=", "&
  • Will be remplaced by "", ""
  • Here, &it& is an alias for the current item in the list (with no confusion, because there is only one variable)
maproot => { host2ip("&host&"), escape("&host&") },
admit => { host2ip("&host&"), escape("&host&") };

} &
  • host is an alias for the current value of POLICYCHILDREN
  • uuid is an alias for the current value of CHILDRENID
  • Both item are iterated at the same time, so both list must have the same length

Remplacement of variable with one or more value, and writing an index all along

&FILE_AND_FOLDER_MANAGEMENT_PATH:{path |"file[&i&][path]" string => "&path&";
  • i is an iterator, starting at 1

The result would be:

"file[1][path]" string => "/var";
"file[2][path]" string => "/bin";

Conditionnal writing of a section




The variable must either be:

  • A boolean: If its value is true, then the section will be displayed
  • A variable with the parameter MAYBEEMPTY="true": If the value is not set, then the section won’t be displayed, otherwise it will be displayed

More information can be found here:

Unique identifier of Directive for Techniques with separated policy generation

As of Rudder 4.3, Techniques with separated policy generation (see tag POLICYGENERATION in metadata.xml) need to have a way to identify uniquely their generated files, and bundles and methods. The special placeholder RudderUniqueID is replaced at generation by the identifier of the Directive. It can be used anywhere in the .st files, or even in the OUTPATH.