Technique editor

Introduction

First, what is a Technique?

A technique is a description in code form of what the agent has to do on the node. This code is actually composed of a series of Generic method calls. These different Generic method calls are conditional.

What is a Generic method?

A generic method is a description of an elementary state independent of the operating system (ex: a package is installed, a file contains such line, etc…​). Generic methods are independent of the operating system (It has to work on any operating system). Generic methods calls are conditioned by condition expressions, which are boolean expression combining basic conditions with classic boolean operators (ex : operating system is Debian, such generic method produced a modification, did not produce any modification, produced an error, etc…)

Technique Editor

Utility

Rudder provides a set of pre-defined Techniques that cover some basic configuration and system administration needs. Of course,this set of techniques cannot responds to all of the specific needs of each client. That’s why Rudder integrate the Technique editor, a tool to create advanced Techniques. Directly accessible from Ruder menu (Configuration policy → Techniques), this tool has an easy-to-use interface, which doesn’t require any programming skills but nevertheless allows to create complex Techniques.

Interface

Here is an overview of its interface :

1 rudder technique editor
1 rudder technique editor open

The interface is divided into 3 columns:

  • A column listing custom Techniques

2 list techniques

Here, we can see our previously created Techniques. We can click on them to see their details/edit them, or create a new one by clicking on the “New” button. Theses Techniques are visible in the ncf techniques category in the Directives tree, so can be used to create new Directives.

  • A column with the Technique content

When we create a new Technique, or when we edit an existing one, the configuration form appears at the center of the interface, instead of the title and the description of the tool.

3 ntp configuration

Then we can see the name, the description, the Bundle name, the version and the Generic methods list of the current Technique. Only the name and the description are editable, the Bundle name and the version are automatically defined during the Technique creation.

The description field of a technique supports markdown format and will be displayed in directives which are using it.

You can add parameters to a technique to make it reusable. Go to Parameters and add a name and a description.

technique editor parameters

You can now use it in generic method instead of static value.

technique parameters ntp

You can also add resources to a technique. Go to Resources and Manage resources.

technique resources
technique upload resource
technique uploaded file
technique resource added
  • A column listing Generic methods / displaying generic method details

To the right of the interface is the list of Generic methods available for Technique configuration. This list is made up of about a hundred Generic methods, grouped according to their category to make them easier to use (an exhaustive list can be found in the reference documentation)

4 list generics method

You just need to click on a Generic method or drag’n drop it in the area provided for such purpose to add it to the current Technique. Once it’s done, you can configure it by clicking on it. Then a new display containing the method details appears instead of the Generic methods list:

5 configure generic method

The Generic method details are divided into 3 blocks :

  1. Conditions

    • Conditions allow user to restrict the execution of the method.

  2. Parameters

    • Parameters are in mono or multi line text format. They can contains variables which will be extended at the time of the execution.

  3. Result conditions

    • One result condition of three will be defined following the execution of a generic method:

      • Success, when the configuration is correct and no action are needed

      • Repaired, when the configuration is wrong and actions to fix it were executed with success

      • Error, when the configuration is wrong but actions to fix it failed

Those conditions can be used in another Generic methods conditions. ie, you can execute a command if a previous one failed or was repaired.

Create your first Technique

Now we are going to see how to create a simple technique to configure a ntp server, step by step.

General information

Let’s start from the beginning. Click on the "New Technique" button and start filling in the General information fields (only name is required).

In our case:

  • Name: Configure NTP

  • Description: Install, configure and ensure the ntpd is running. Uses a template file to configuration.

Add and configure generic methods

Now, we have to find and add the generic methods which correspond to the actions we want to execute. In our case, we want to add the following methods:

  • Package present (You can find it in the Package category)

    • This method only take one parameter, the name of the package to install. So here, fill in the package_name field with the value ntp.

  • File content (You can find it in the File category)

    • This method take two parameters. The first one corresponds to the absolute path of the source file containing a template to be expanded. We are going to use a Rudder variable here to get the correct path. Fill in the source_template field with the value ${path_technique}/templates/ntp.conf.

    • The second corresponds to the absolute path of the destination file. Fill in with the value /etc/ntp.conf.

  • Service restart (You can find it in the Service category)

    • This method only take one parameter, the name of the service we want to restart. So here, fill in the service_name field with the value ntp.

    • Also, we want to restart the service only if it has just been installed, so only if the result conditions defined following the execution of Package install method is Repaired (package_install_ntp_repaired). So here, fill in the Other conditions field in the Conditions panel with the value package_install_ntp_repaired.

  • Service enabled at boot (You can find it in the Service category)

    • This method only take one parameter, the name of the service we want to check. Again, here, fill in the service_name field with the value ntp.

You can also use parameters and resources to replace "File content" method by "File from local source with check" :

technique resource usage

Save and apply your technique

And… It’s already done. Rather fast, right? Don’t forget to save. Now you can see it in the Directives tree, and use it to create a Directive that will be applied on your Nodes thanks to a Rule.


← Configuration concepts Variables →