use hiera for variables
authormh <mh@immerda.ch>
Tue, 6 Sep 2011 21:00:03 +0000 (23:00 +0200)
committermh <mh@immerda.ch>
Tue, 6 Sep 2011 21:00:03 +0000 (23:00 +0200)
manifests/init.pp
templates/resolvconf.erb

index 68c3eb5..257fa19 100644 (file)
 #
 
 class resolvconf {
-  case $operatingsystem {
-    openbsd: {
-      info('$resolvconf_domain and $resolvconf_search not needed on openbsd')
-    }
-    default: {
-      if ! $resolvconf_domain {
-        fail("you need to define \$resolvconf_domain for ${fqdn}")
-      }
-      if ! $resolvconf_search {
-        fail("you need to define \$resolvconf_search for $fqdn")
-      }
-    }
-  }
-  if ! $resolvconf_nameservers {
-    fail("you need to define \$resolvconf_nameservers for $fqdn")
-  }
   file{'/etc/resolv.conf':
-    path => '/etc/resolv.conf',
-    owner => root, group => 0, mode => 0444,
     content => $operatingsystem ? {
       openbsd => template("resolvconf/resolvconf.$operatingsystem.erb"),
       default => template('resolvconf/resolvconf.erb'),
     }
+    owner => root, group => 0, mode => 0444;
   }
 }
index 0c274a6..dc98aea 100644 (file)
@@ -1,7 +1,8 @@
 # managed by puppet
-domain <%= resolvconf_domain %>
-search <%= resolvconf_search %>
+<% Puppet::Parser::Functions.function('hiera') -%>
+domain <%= scope.function_hiera('resolvconf_domain',domain) %>
+search <%= scope.function_hiera('resolvconf_search',domain) %>
 
-<% resolvconf_nameservers.split(':').each do |nameserver| -%>
+<% scope.function_hiera('resolvconf_nameservers',['8.8.8.8']).each do |nameserver| -%>
 nameserver <%= nameserver %>
 <% end -%>