Variables

General

In Rudder, you can define and use variables via the technique editor or the differents pre-built techniques.

All variables are defined under a prefix (scope), so to reference a variable you will always need its prefix and its name, separated via a . char. To call a variable in Rudder we use ${…​} brackets syntax as described below:

For backward compatibility, the syntax $(…​) is also supported, but deprecated and not recommanded.
// Call to a String or Iterator variable
${<prefix>.<variable name>}

// Call to a key in a Dict variable
${<prefix>.<variable dict name>[key][sub-key]}

The prefix will allow you to easily organize your variables and re-use the already taken name defining a new prefix.

Variables are also typed and can be: * A classic String * A Dict, which support key-values and arrays * Or an Iterator which is used to loop over things in Rudder.

More over, all variables in Rudder are overridable at execution time, keep in mind that ordering the definition of your variables is important.

User defined parameters

Rudder provides a simple way to add common and reusable variables in either plain directives, or techniques created using the technique editor: the parameters.

Parameters

The parameters enable the user to specify a content that can be put anywhere, using the following syntax:

  • In directives: ${rudder.param.name} will expand the content of the "name" parameter.

  • In the technique editor: ${rudder_parameters.name} will do the same.

Using this, you can specify common file headers (this is the default parameter, "rudder_file_edit_header"), common DNS or domain names, backup servers, site-specific elements…​

Inventory variables

Theses variables have been introduced in Rudder 5.0.13, if you are using a previous version of Rudder, please use System Variables, described in next section

Informations about current node:

Variable Description

${node.inventory[hostname]}

Node hostname

${node.inventory[localAdministratorAccountName]}

Node administrator login

${node.inventory[archDescription]}

The architecture of the node (like "x86_64")

${node.inventory[ram]}

The amount of RAM on the node (in bytes)

${node.inventory[timezone]}

The name of the timezone of the node (like "Europe/Paris")

${node.inventory[os][name]}

The operating system name (like "Debian")

${node.inventory[os][fullName]}

The operating system full name (like "Debian GNU/Linux 9.1 (stretch)")

${node.inventory[os][version]}

The operating system version (like "9.1")

${node.inventory[os][kernelVersion]}

The kernel version on the node (like "4.9.0-3-amd64")

${node.inventory[os][servicePack]}

The operating system service pack (like "4")

${node.inventory[machine][machineType]}

The machine type (like "qemu", "physical")

${node.inventory[machine][manufacturer]}

The manufacturer of the machine (like "innotek GmbH")

${rudder.inventory[policyServerId]}

The Rudder generated id of the node Policy Server

System Variables

Rudder also provides system variables that contain information about nodes and their policy server. You can use them like user defined parameters.

In the Directive parameters

These variables are only usable in the directive parameters and not in the technique editor,

Informations about current node:

Variable Description

${rudder.node.id}

Rudder id of the node

${rudder.node.hostname}

Node hostname

${rudder.node.admin}

Node administrator login

${rudder.node.state}

The node lifecycle of the node

${rudder.node.policyMode}

the effective policy mode of the node

Informations about a node’s policy server:

Variable Description

${rudder.node.policyserver.id}

The Rudder generated id of the Policy Server

${rudder.node.policyserver.hostname}

The hostname of the Policy Server

${rudder.node.policyserver.admin}

The administrator login of the Policy Server

In the Technique Editor

These variables are not available on Windows nodes, but only on with the classic Linux/AIX agent and within the Technique Editor.

Node-level system properties

These properties are evaluated on the node at run time, and are hence available both in directives parameters and in the technique editor:

Variable Description ${sys.arch}

Kernel short architecture

${sys.fqhost}

Fully qualified hostname, as seen in Rudder

${sys.uqhost}

Unqualified hostname

${sys.host}

Node’s hsotname (according to the kernel)

${sys.domain}

Node’s domain as discovered by the agent

There are also more variables available, all documented in this page.

Constants

Variable Description

${const.dollar}

$

${const.dirsep}

/

${const.endl} or ${const.n}

\n

${const.r}

carriage return

${const.t}

tabulation

${ncf_const.s}

space char


← Man pages General →