Skip to content

Instantly share code, notes, and snippets.

@jooooooon
Created March 19, 2011 10:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jooooooon/877380 to your computer and use it in GitHub Desktop.
Save jooooooon/877380 to your computer and use it in GitHub Desktop.
body common control {
bundlesequence => { "set_dns_configuration" } ;
}
#######################################################################
# Configure DNS
# Use Google's DNS servers, and set the defaut domain to normation.com
#######################################################################
bundle agent set_dns_configuration {
vars:
"resolvers" slist => { "8.8.8.8", "8.8.4.4" };
"searchlist" slist => { "normation.com" };
files:
"$(sys.resolv)"
create => "true",
edit_line => doresolv("@(this.searchlist)","@(this.resolvers)"),
comment => "Configuring the searchlist and dns in the resolv.conf file ";
}
#######################################################
# Configure the resolv.conf file
# Setting the search and nameserver values
# Adding a header to tell the file is configured by Cfengine
#######################################################
bundle edit_line doresolv(search,resolvers) {
delete_lines:
"search.*";
"nameserver.*";
insert_lines:
"#############################################################
### This file is configured by Cfengine.
### Manually editing the file might lead Cfengine
### to change back its content
#############################################################"
location => start,
insert_type => "preserve_block";
"search $(search)";
"nameserver $(resolvers)";
}
# This body comes from the cfengine_stdlib.cf
body location start {
before_after => "before";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment