bundle agent system_files { vars: "searchlist" string => "iu.hio.no CFEngine.com"; "nameservers" slist => { "128.39.89.10", "128.39.74.16", "192.168.1.103" }; files: "$(sys.resolv)" # test on "/tmp/resolv.conf" # create => "true", edit_line => doresolv("$(s)","@(this.n)"), edit_defaults => empty; # .... } ####################################################### bundle edit_line doresolv(search,names) { insert_lines: "search $(search)"; "nameserver $(names)"; } ``` bundle agent system_files { # ... files: "/etc/hosts" comment => "Add hosts to the /etc/hosts file", edit_line => fix_etc_hosts; } ########################################################### bundle edit_line fix_etc_hosts { vars: "names[127.0.0.1]" string => "localhost localhost.CFEngine.com"; "names[128.39.89.12]" string => "myhost myhost.CFEngine.com"; "names[128.39.89.13]" string => "otherhost otherhost.CFEngine.com"; # etc "i" slist => getindices("names"); insert_lines: "$(i) $(names[$(i)])"; }