Providing configuration data

For now we have only manipulated statically defined information, may it be for group definition or inside the configuration itself. This is the simplest use-case, but Rudder allows to easily define and use dynamic data.

Separating data from code

In this section we will see:

  • how to attach data to each node

  • how to use it for group definition

  • how to use it inside configuration policies

Rudder has basically three types of variable data:

  • Global parameters that apply to the whole Rudder instance

  • Variables defined inside the configuration policies, associated to a set of groups

  • Variables associated to a node

We will here use the last one to define a property for our node. Go to the node details, for example using the quick search bar, and go to the Properties tab. This is a small key-value database associated to each node.

Define an env = production variable.

Definition of a node property

Then click on the plus sign to add the property.

We now have associated a new property to our node. Let’s use it to define a group of production boxes.

Classify nodes using node properties

Go to the groups page, and create the Production nodes group, defined by:

Definition of the production group

It should contain our node machine.

We will also start defining data for the next policy we will build, still for the node machine.

Let’s define a JSON property called website (you need to set its type to JSON), with the following content:

{
  "webroot": "/var/www/html",
  "domain": "example.com",
  "port": 8080
}

This will be translated in the configuration of a website we will do on the node machine in the next part of this tutorial.

As you can already see, this property is a JSON object, which allows us to define more advanced variables with a hierarchical content.

To sum things up:

  • Rudder has rich variables features

  • Variables can be scalar or hierarchical objects

  • Variables can be defined on the server: globally, by policy or by node

  • Node variables can be used for business-oriented classification

  • Variables can also be defined locally, during agent execution, to use local data


← Classify nodes Configuration policy management →