merged with immerda
authorMarcel Haerry <haerry@puzzle.ch>
Mon, 25 May 2009 08:53:10 +0000 (10:53 +0200)
committerMarcel Haerry <haerry@puzzle.ch>
Mon, 25 May 2009 08:53:10 +0000 (10:53 +0200)
manifests/init.pp
templates/resolvconf.OpenBSD.erb [new file with mode: 0644]
templates/resolvconf.erb

index 39ddeee..97423f4 100644 (file)
 # modules_dir { "resolvconf": }
 
 class resolvconf {
-    $real_resolvconf_domain = $resolvconf_domain ? {
-        ''  => 'rz.puzzle.ch',
-        default => $resolvconf_domain,
+    case $operatingsystem {
+        openbsd: { info("\$resolvconf_domain and  \$resolvconf_search not needed on openbsd") }
+        default: {
+            case $resolvconf_domain {
+                '': { fail("you need to define \$resolvconf_domain for ${fqdn}") }
+            }
+            case $resolvconf_search {
+                '': { fail("you need to define \$resolvconf_search for ${fqdn}") }
+            }
+        }
     }
-    $real_resolvconf_search = $resolvconf_search ? {
-        ''  => 'rz.puzzle.ch worldweb2000.com',
-        default => $resolvconf_search,
-    }
-    $real_resolvconf_nameservers = $resolvconf_nameservers ? {
-        ''  => '195.141.101.81:195.141.101.82',
-        default => $resolvconf_nameservers,
+    case $resolvconf_nameservers {
+        '': { fail("you need to define \$resolvconf_nameservers for ${fqdn}") }
     }
 
     file { '/etc/resolv.conf':
@@ -33,6 +35,9 @@ class resolvconf {
         owner => root,
         group => 0,
         mode => 444,
-        content => template("resolvconf/resolvconf.erb")
+        content => $operatingsystem ? {
+            openbsd => template("resolvconf/resolvconf.${operatingsystem}.erb"),
+            default => template('resolvconf/resolvconf.erb'),
+        }
     }
 }
diff --git a/templates/resolvconf.OpenBSD.erb b/templates/resolvconf.OpenBSD.erb
new file mode 100644 (file)
index 0000000..27c2a69
--- /dev/null
@@ -0,0 +1,5 @@
+# managed by puppet
+lookup file bind
+<%- resolvconf_nameservers.split(':').each do |nameserver| -%> 
+nameserver <%= nameserver %> 
+<%- end -%>
index 0bc467f..c9a43cc 100644 (file)
@@ -1,8 +1,7 @@
 # managed by puppet
+domain <%= resolvconf_domain %>
+search <%= resolvconf_search %>
 
-domain <%= real_resolvconf_domain %>
-search <%= real_resolvconf_search %>
-
-<% real_resolvconf_nameservers.split(':').each do |val| -%> 
-nameserver <%= val %> 
-<% end -%>
+<%- resolvconf_nameservers.split(':').each do |nameserver| -%>
+nameserver <%= nameserver %>
+<%- end -%>