]> git.donarmstrong.com Git - dsa-puppet.git/blob - modules/resolv/templates/resolv.conf.erb
0ebef6c5b81e678a826f09b9332339726219d12e
[dsa-puppet.git] / modules / resolv / templates / resolv.conf.erb
1 ##
2 ### THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
3 ### USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git
4 ###
5
6 <%=
7 nameservers = []
8 searchpaths = []
9 options = []
10
11 if %w{draghi liszt widor spohr}.include?(hostname)
12   nameservers << "127.0.0.1"
13 end
14
15 nameservers += nodeinfo['hoster']['nameservers'] if nodeinfo['hoster']['nameservers']
16 searchpaths += nodeinfo['hoster']['searchpaths'] if nodeinfo['hoster']['searchpaths']
17 options += nodeinfo['hoster']['resolvoptions'] if nodeinfo['hoster']['resolvoptions']
18
19 searchpaths << "debian.org"
20
21 resolvconf  = ''
22 resolvconf += "search " + searchpaths.join(" ") + "\n"
23
24 unbound = lookupvar('unbound')
25 if unbound and unbound == "true"
26   resolvconf += "nameserver 127.0.0.1\n"
27 else
28   if nameservers.empty?
29     raise Puppet::ParseError, "Something has gone wrong writing resolv.conf.  No nameservers to use!"
30   end
31
32   nameservers.each do |ns|
33     resolvconf += "nameserver " + ns + "\n"
34   end
35 end
36
37 options.each do |opt|
38   resolvconf += "options " + opt + "\n"
39 end
40
41 resolvconf
42 %>