umwandlung in class, und def. von variablen
authoram <am@d66ca3ae-40d7-4aa7-90d4-87d79ca94279>
Mon, 10 Mar 2008 13:21:57 +0000 (13:21 +0000)
committeram <am@d66ca3ae-40d7-4aa7-90d4-87d79ca94279>
Mon, 10 Mar 2008 13:21:57 +0000 (13:21 +0000)
git-svn-id: https://svn/ipuppet/trunk/modules/resolvconf@1057 d66ca3ae-40d7-4aa7-90d4-87d79ca94279

manifests/init.pp
templates/resolvconf.erb [new file with mode: 0644]

index e444480..58dc83f 100644 (file)
@@ -4,25 +4,37 @@
 
 # modules_dir { "resolvconf": }
 
-class resolvconf {}
-
-define resolvconf::create (
-    $domain='glei.ch', 
-    $search='glei.ch',
-    $nameserver1='212.103.67.60',  
-    $nameserver2='212.103.72.231', 
-    $nameserver3='192.168.1.104'
-) {
-    $str = "search $search
-domain $domain
-nameserver $nameserver1
-nameserver $nameserver2
-nameserver $nameserver3
-"
-
-    file { "/etc/resolv.conf":
-        content => $str
+class resolvconf {
+    $real_resolvconf_domain = $resolvconf_domain ? {
+        ''  => 'glei.ch',
+        default => $resolvconf_domain,
     }
+    $real_resolvconf_search = $resolvconf_search ? {
+        ''  => 'glei.ch',
+        default => $resolvconf_search,
+    }
+    $real_resolvconf_nameserver1 = $resolvconf_nameserver1 ? {
+        ''  => '212.103.67.60',
+        default => $resolvconf_nameserver1,
+    }
+    $real_resolvconf_nameserver2 = $resolvconf_nameserver2 ? {
+        ''  => '212.103.72.231',
+        default => $resolvconf_nameserver2,
+    }
+    $real_resolvconf_nameserver3 = $resolvconf_nameserver3 ? {
+        ''  => '192.168.1.104',
+        default => $resolvconf_nameserver3,
+    }
+
+    file { '/etc/resolv.conf':
+        path => '/etc/resolv.conf',
+        owner => root,
+        group => 0,
+        mode => 444,
+        content => template("resolvconf/resolvconf.erb")
+    }
+
+
 }
 
 
diff --git a/templates/resolvconf.erb b/templates/resolvconf.erb
new file mode 100644 (file)
index 0000000..58efe73
--- /dev/null
@@ -0,0 +1,8 @@
+# managed by puppet
+
+domain <%= real_resolvconf_domain %>
+search <%= real_resolvconf_search %>
+nameserver1 <%= real_resolvconf_nameserver1 %>
+nameserver2 <%= real_resolvconf_nameserver2 %>
+nameserver3 <%= real_resolvconf_nameserver3 %>
+