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 having issues with CFEngine's templating system. I install a package, ganglia in this specific case, that creates a default config file. Then I want to add lines to /etc/ganglia/gmond.conf depending on if its the the collection server or if its just feeding information out and whate colo the server is in. So I made a template and I'm using some variables for where I want different information.

When I manually remove /etc/ganglia/gmond.conf and run cfagent the template is expanded properly and looks correct.

When I run cfagent with the default config from the ganglia package in place it just appends the lines that don't exist to the bottom of the default config file.

Right now the expand_template block I'm using looks like:

            comment         => "Expanding gmond.conf template",
            create          => "true",
            edit_line       => expand_template("$(g.inputfiles)/modules/ganglia/templates/gmond.conf");

I'm guessing there's something I want to use beside edit_line but my google-fu is failing me.

We are using the community editition of cfengine3 with just the standard library.

share|improve this question
up vote 2 down vote accepted

Try edit_defaults => empty in your promise. That will empty the file before the agent edits. The key word empty is a body fond in the cfengine standard library.

share|improve this answer
apologies for the slow response this worked – Tawm Sep 10 '13 at 23:39

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.