Forum: CFEngine Help
Subject: Re: How to add to line with field_edits?
Author: zzamboni
Link to topic: https://cfengine.com/forum/read.php?3,22981,22983#msg-22983

You could specify the list of servers as a string, and then use 
set_config_values 
https://github.com/zzamboni/cfengine-copbl/blob/master/cfengine_stdlib.cf#L207

Something like this:

bundle agent test
{
vars:
 "config" string => "server1 server2 server3" ;

files:
  "/foo/bar"
       create    => "false",
       edit_line => set_config_values("config");
}


set_config_values will:

* If the line already exists, and is correct, leave it alone.
* If a "uri" line already exists, but with incorrect value, edit it to set the 
correct value.
* If a "uri" line already exists, but commented out, it will uncomment it and 
make sure it has the right value.


_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to