]> git.donarmstrong.com Git - dsa-puppet.git/blob - modules/resolv/templates/resolv.conf.erb
or that there
[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 if defined?(unbound) and unbound and unbound == "true"
25   resolvconf += "nameserver 127.0.0.1\n"
26 else
27   if nameservers.empty?
28     raise Puppet::ParseError, "Something has gone wrong writing resolv.conf.  No nameservers to use!"
29   end
30
31   nameservers.each do |ns|
32     resolvconf += "nameserver " + ns + "\n"
33   end
34 end
35
36 options.each do |opt|
37   resolvconf += "options " + opt + "\n"
38 end
39
40 resolvconf
41 %>