Skip to content
This repository has been archived by the owner on Feb 17, 2023. It is now read-only.
Tim O'Brien edited this page Nov 18, 2012 · 37 revisions

What is the CFEngine Design Center?

The Design Center is a public repository for customizable CFEngine design patterns and code. Here you can download finished solutions to use and adapt them for your environment, or find examples that inspire you to develop new patterns. The CFEngine Design Center is a place for infrastructure engineers to share and re-use knowledge and expertise.

Design Center Elements

The CFEngine Design Center contains two types of content (Policies and Sketches) as well as a collection of useful management tools.

CFEngine Policies

CFEngine policies are CFEngine promises are core concepts in CFEngine. A promise is a statement, written in plain text using the CFEngine language, that describes the desired state of a system, and a policy is a collection of one or more related promises. If CFEngine the cf-agent is constantly checking on systems and using policies to ensure that a system's promises are kept.

If your infrastructure includes MySQL, Apache, or Wordpress you need a policy that tells CFEngine where files are installed, and how services are started. CFEngine reads this detailed policy file and understands how to install, configure, and manage each component. Learning the syntax of policy files is essential for CFEngine users and this Design Center contains hundreds of CFEngine policies to provide a starting point for executing complex tasks in CFEngine.

Policy files are the low-level configuration files that tell the cf-agent what to do and when to do it. For a higher level of configuration, the Design Center introduces a new concept - the CFEngine Sketch.

CFEngine Sketches

A CFEngine Sketch is a ready-to-use component containing a collection of one or more CFEngine Policies packaged with metadata to describe configuration parameters, dependencies, and other descriptive information such as who created a particular Sketch and the license for a particular Sketch. Using a Sketch is easy, instead of copying a series of complicated policies into your own CFEngine configuration, you can reference a Sketch as a library and import it into your own CFEngine policies.

This ability to import a Sketch and reference it from your own CFEngine configuration gives you access to a library of reusable components without adding additional configuration to your own CFEngine projects. If you need to configure cron, MySQL, sshd, and an Apache Web Server, all of these are readily available Sketches that can be reused - you don't have to reinvent the wheel every time you need to use a common software component.

Sketches are organized into categories according to their functionality: web_servers, web_apps, security, and utilities are examples of catgories you will find in the CFEngine Design Center. Most sketches are specialized for achieving a specific task or for maintaining a specific software package. Some software packages such as sshd make have single Sketch with a number of configurable parameters while some other software packages may grow to have multiple Sketches created for users with very distinct use cases.

CFEngine Tools

In addition to providing a library of reuseable Policies and Sketches, the CFEngine Design Center also provides a series of tools to manage, test, and modify CFEngine Policies and Sketches. The following tools are available in the CFEngine Design Center

CFEngine Management Tools

  • cf-sketch - Sketches are managed (installed, configured, enabled and uninstalled) through this tool. Learn more about cf-sketch.
  • cf-cmd -
  • newsketch -

Tools for Testing CFEngine

  • cfpromises_customcheck -
  • git-pre-commit -
  • vagrant-cfenging -

What can I do with the CFEngine Design Center?

Whether you are just getting started with CFEngine or are a veteran writing CFEngine policies, the Design Center has something for you.

For beginners, the Design Center allows you to quickly get started with the implementation of a CFEngine infrastructure, without touching a single line of CFEngine code. The sketches available from the DC have been carefully reviewed and tested to guarantee that they will perform their task as indicated. Using sketches, you can, for example:

  • Install and configure MySQL on a Linux server, using the db_install sketch.
  • Install and configure Wordpress on a Linux server, using the wordpress sketch.
  • Configure sshd on a Unix server, using the ssh sketch.
  • Configure DNS Settings, the local hosts table, or the system clock timezone using the config_resolver, etc_hosts or tzconfig sketches, respectively.

The cf-sketch tool installs the sketches, configures their parameters, and enables them for execution, all through a command-line interface so that you do not have to learn the CFEngine policy language and still benefit from the power of CFEngine for managing your infrastructure. Additionally, the code for all the sketches is publicly available on github, and is an excellent resource for learning new techniques once you decide to learn the policy language.

If you are an advanced CFEngine user, you will find in the Design Center many components for managing complex tasks. The use of these sketches will allow you to greatly simplify your policies, while retaining full control over the parameters used, and may even allow you to do a few complex things that you had not implemented yet.

Using the cf-sketch tool, you can easily set class expressions which control where each sketch will be executed, and with which parameters. You can activate each sketch more than once with different parameters, so you can easily perform the same task under different situations. Of course, you can also invoke sketches directly from your policies by calling the appropriate bundles yourself, thus giving you the ultimate flexibility in how sketches are integrated into your environment.

In addition, you have probably accumulated over time a good number of useful CFEngine bundles and body definitions, and techniques for performing useful tasks. We encourage you to contribute to the Design Center, so that more people can benefit from your experience and knowledge.

What's next?

We invite you to

If you have any comments, please let us know by sending email to [email protected].

Clone this wiki locally