Sunday 24 April 2016

Getting started with CFEngine part 1 (The basics)


This quick start guide is based on my understanding CFEngine concepts & working.
I've tried to make it as understandable & precise as I could.

CFEngine is a configuration management & automation tool that has been around since the 90s.
It works on a variety of UNIX platforms as well as Windows.

Some of its features are:
Ensures systems have self-healing capabilities.
Convergence of systems to reach a desired state of configuration

Some low level examples include:



  •  Build new nodes
  • Deploy & manage services & applications
  • Managing databases
  • Manage ACLs

                                                                                                  
Components of CFEngine:

Cf-agent
Cf-monitord
Cf-execd
Cf-serverd

In CFEngine a desired state configuration of nodes is reached via implementation of policies.

Server-client architecture:



CFEngine is based on a server-client architecture wherein the cf-agent running on the client communicates with the cf-serverd daemon on the server (hub) for policy updates every 5 minutes.


The next part introduces some key terms used in writing configurations to be executed by CFEngine.

Promise Theory:

A Model of voluntary cooperation between individual agents who publish their intentions to one another in the form of promises.
Files & processes can make promises about their contents.

A process can make a promise to be in running state but cannot make a promise regarding its configuration.

Anatomy of a promise:

type:
 context::
       "promiser" -> "promisee"
         attribute => "value";

In the above example:

type can be files or commands.
context is a condition deciding where & when to execute the promise.
promiser is the file or process making the promise.
attribute details & constrains a promise.

Bundles:

A bundle is a logical grouping of promises that are written with the aim of achieving a common end goal. For example promises written to install, configure & start MySQL.

Anatomy of a bundle:

bundle type name{
type;
 context::
       "promiser" -> "promisee"
         attribute => "value";
}

Bundles apply to the binary that executes them. Agent bundles apply to cf-agent.

Body:

A body is a collection of attributes.

Anatomy of a body:

body type name{
         attribute1 => "value";
         attribute2 => "value";
}

In a body every attribute ends with a semi colon.


The components discussed above come together in the form of a plain text file with .cf extension called a policy. 

No comments:

Post a Comment

Using capture groups in grep in Linux

Introduction Let me start by saying that this article isn't about capture groups in grep per se. What we are going to do here with gr...