0

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:

    "/etc/ganglia/gmond.conf"
            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.

1 Answer 1

2

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.

https://cfengine.com/docs/3.5/reference-promise-types-files.html#edit_defaults

1
  • apologies for the slow response this worked
    – Tawm
    Sep 10, 2013 at 23:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .