Hi all,
I just recently started using CFEngine 3 and was wondering what the best 
practice for constructing system configuration files (e.g., /etc/resolv.conf) 
is.  Right now I am just adding and deleting lines from the file, but it seems 
to execute with every run of cf-execd.  On the other hand, I am pulling down a 
global /etc/passwd file from the server, and that seems to execute much more 
efficiently since it only gets copied when I make changes to that.  Any 
suggestions would be greatly appreciated!

Also, here is the bundle I am currently trying to execute.  The delete_lines 
doesn't seem to work, but that is probably my fault and I will just look 
further into it.

bundle agent resolv_file
{
        vars:
          "resolv_fields" slist => {"search <search domains>","nameserver 
<ip>","nameserver <ip>","nameserver <ip>"};
        files:
          "/etc/resolv.conf"
                edit_line => DeleteLinesMatching("^nameserver.*"),
                edit_line => addline($(resolv_fields));
}

bundle edit_line DeleteLinesMatching(regex)
{
        delete_lines:
          "$(regex)";
}

bundle edit_line addline(resolvList)
{
        insert_lines:
          "$(resolvList)";
}

Thanks,
Scott

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

Reply via email to