Hi,
I was looking the cfengine solution page, and found this :
https://cfengine.com/inside/manuals/cf3-solutions#Set-up-name-resolution
I'm might be wrong, but the generated file doesn't contains the
nameserver lines.
To have something a bit more readable (and platform independent,
because using the "search" in the variable doesn't fell right) I would
do :
#######################################################
#
# Resolv conf
#
#######################################################
bundle common g # globals
{
vars:
"searchlist" slist => {
"iu.hio.no",
"cfengine.com"
};
"nameservers" slist => {
"128.39.89.10",
"128.39.74.16",
"192.168.1.103"
};
classes:
# This sets a class if we are in the name server list
"am_name_server" expression => reglist("@(nameservers)","$(sys.ipv4[eth1])");
}
#######################################################
body common control
{
any::
bundlesequence => {
"g",
resolver(@(g.searchlist),@(g.nameservers))
};
}
#######################################################
bundle agent resolver(s,n)
{
files:
# When passing parameters down, we have to refer to
# a source context
"$(sys.resolv)" # test on "/tmp/resolv.conf" #
create => "true",
edit_line => doresolv("@(this.s)","@(this.n)"),
edit_defaults => reconstruct;
# or edit_defaults => modify
}
#######################################################
# For the library
#######################################################
bundle edit_line doresolv(search,resolvers) {
insert_lines:
"search $(search)";
"nameserver $(resolvers)";
}
#######################################################
body edit_defaults reconstruct
{
empty_file_before_editing => "true";
edit_backup => "false";
max_file_size => "100000";
}
#######################################################
body edit_defaults modify
{
empty_file_before_editing => "false";
edit_backup => "false";
max_file_size => "100000";
}
Regards,
Nicolas
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine