Configuration and change management with Bcfg2

Reporting

In the third and final phase, the client generates a report containing the system status and other details, including the number of correct and incorrect configuration entries and the number of non-managed objects on the system. The client sends this message to the server, which then processes it to create web pages, RSS feeds, and emails.

The core of any Bcfg2 system is the configuration specification. Administrators use it to describe the target configurations for the systems they manage. This process occurs in two stages: Bcfg2 refers to the structure looked at earlier, as well as the profiles, groups, and bundles it contains as metadata. The metadata define the elements that Bcfg2 needs to configure for a client.

When a client sends a request to a server, the server generates the abstract configuration from the matching metadata (see Figure 2). This template contains all the required configuration entries for the target system, but without any content. For example, a ConfigFile element contains a file name, but not the file content.

Generators

After the server has created the framework of the configuration, it uses generators to bind tangible information to each entry. Bcfg2 uses a number of generators written in Python.

The administrator needs to enable generators in the /etc/bcfg2.conf file. A typical installaton would at least use

generators = Cfg, Pkgmgr, Rules, TCheetah

Each registered generator is capable of instantiating a number of configuration elements.

In simple cases, the Cfg generator will return a static file, and in more complex cases, a TCheetah generator will use a template and script language to retrieve the file content from a database entry. Other generators handle configuration elements, such as services and packages. Consequently, Bcfg2 is capable of using almost any data source to compile a tangible configuration (see Figure 3).

Cfg

The Cfg plugin mainly generates content for ConfigFile-type entries. To configure an element, the administrator creates a subdirectory below Cfg in the repository with the same name as the corresponding bundle. Then you create a static file in the directory and let Bcfg2 distribute the file to all your clients.

To define the target clients, you can add suffixes to file names. The H_Hostname suffix distributes the file to the specified machines only; GPrio_Group sends the file to all systems that have the specified group profile. If a host belongs to multiple groups, Bcfg2 applies the highest priority file.

An :info file in the same directory defines permissions, with entries like:

owner: root
group: admin
perms: 0644

Also, you can specify values such as the file encoding or the behavior for local changes. The functionality provided by the Cfg generator helps you manage a major part of the system; however, it does not always offer the flexibility required to manage large-scale systems.

To manage large networks, the Bcfg2 developers created the TCheetah generator, based on the Cheetah template language [7]. Cheetah supports instructions that range from simple string operations, to flow control, to Python code embedded directly in configuration files.

TCheetah adopts the Cfg generator's directory structure with directories below /var/lib/bcfg2/TCheetah representing the configuration elements. Each directory contains an info file with the same content as the Cfg generator, along with a template configuration. Cheetah code, which can contain some Bcfg2-specific extensions, is then added. Dropping Listing 4 into /var/lib/bcfg2/TCheetah/etc/motd/template would create a dynamic message of the day. The TCheetah Generator replaces $self.metadata.hostname with the actual values and then runs the loop that starts with #for.

Listing 4

Script for an Automatic motd

01 Welcome to $self.metadata.hostname!
02
03 This system is managed by Bcfg2. It is a
04 member of the following groups:
05
06 #for $group in $self.metadata.groups:
07  * $group
08 #end for

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Network Management Intro

    Professional admins with tightening IT budgets are always looking for new tools that will help them do more with less. This month we feature some popular open source applications for deploying, configuring, updating, and monitoring software and systems on the network.

  • Cfengine 3

    Automate admin tasks with the powerful Cfengine framework.

  • SCPM

    SCPM lets you switch your network configuration when your portable moves to a different network. Read on to learn more about deploying the SCPM profile manager with Suse Linux.

  • Radius and 802.1X

    The Radius protocol is typically used to authenticate users in dial-up scenarios. But Radius is also useful in LAN environments: in combination with 802.1X, Radius forces users to authenticate at a low level before the switch opens up a port.

  • FAI

    FAI helps you automate the process of installing and configuring new Debian systems.

comments powered by Disqus

Direct Download

Read full article as PDF:

030-035_bcfg.pdf  (884.49 kB)

News