Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm looking at using CFEngine on some linux servers.
My problem is that I need to be able to apply separate policys depending on the server. I looked all over their documentation, and I cannot find anywhere that says that that can or cannot be done.
Is that possible using CFEngine? Or should I look somewhere else.

share|improve this question
up vote 2 down vote accepted

It's been a long time ago without using CFengine, but we faced a similar problem when we were using it. Finally, we came up with a solution, using a dynamic bundlesequence. I'm rescuing and modifying an old snippet of code, so the syntax may be wrong, but I think that you'll get an idea.

bundle common g { 
        "some_servers" expression => "someserver01|someserver02";
        "another_servers" expression => "anotherserver01|anotherserver02";
        # Define other classes for your hosts here as needed
            "bs_common" slist => {

            "bs" slist => {

            "bs" slist => {

body control common {
    bundlesequence => {
share|improve this answer

You can use classes to define where the policies will be applied, and by default Cfengine creates a class with the hostname of every server it's running.

For example, in the following promisse if the server hostname is server01 Cfengine will report "Hello master" (check syslog to read the reports), if the hostname is server02 Cfengine will report "Hello slave":

body common control
  bundlesequence => { "hello" };

bundle agent hello


      "Hello master!"
        comment => "It's just a dummy report for server01";


      "Hello slave!"
        comment => "It's just a dummy report for server02";

Ps. You can run this example policy from a file named with:

cf-agent -I -f

You can find more information about classes and operations using them in the official docs.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.