diff options
author | andreas <andreas@immerda.ch> | 2008-03-10 13:21:57 +0000 |
---|---|---|
committer | andreas <andreas@immerda.ch> | 2008-03-10 13:21:57 +0000 |
commit | d8aca73440d02619cfc16d1b9524152fbe603a49 (patch) | |
tree | 90ca5bd4f30605384a49ade12864a30b9f1f13e3 | |
parent | 163a44e5bb5d29e2d4a5bdc94b7e80a25d67f74c (diff) | |
download | puppet-resolvconf-d8aca73440d02619cfc16d1b9524152fbe603a49.tar.gz puppet-resolvconf-d8aca73440d02619cfc16d1b9524152fbe603a49.tar.bz2 |
umwandlung in class, und def. von variablen
-rw-r--r-- | manifests/init.pp | 48 | ||||
-rw-r--r-- | templates/resolvconf.erb | 8 |
2 files changed, 38 insertions, 18 deletions
diff --git a/manifests/init.pp b/manifests/init.pp index e444480..58dc83f 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -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 index 0000000..58efe73 --- /dev/null +++ b/templates/resolvconf.erb @@ -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 %> + |