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.


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.


  • apologies for the slow response this worked – Tawm Sep 10 '13 at 23:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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