Forum: CFEngine Help
Subject: Re: maintaining /etc/security/limits.conf with cf3
Author: zzamboni
Link to topic: https://cfengine.com/forum/read.php?3,21465,23246#msg-23246

Sven,

I came across this old post, and was trying to come up with a more concise way 
of solving it. In principle, the code below should work (it uses my 
set_config_values bundle). Unfortunately, I stumbled across a bug in variable 
interpolation that manifests itself only when the array keys have spaces in 
them, so it doesn't work for now. I have reported it in the bug tracker.

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

bundle agent main
{
vars:  
  # Files to edit
  "files" string => "/tmp/limits.conf";

  # Sysctl variables to set
  "limits"                   string => "378";
  "limits"                   string => "768";
  "limits[@group_soft_nproc]"                   string => "2047";
  "limits[@group_hard_nproc]"                   string => "16384";

methods:
  "limits"  usebundle => edit_limits;

}

bundle agent edit_limits
{
vars:
  "index" slist => getindices("main.limits");

files: 
  "$(main.files)"
    create => "true",
    edit_line => set_config_values("main.limits");
}


_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to