From 22f38f9089f28c7c9a3afb8d1b5ad97f43a0ecba Mon Sep 17 00:00:00 2001 From: andreas Date: Mon, 10 Mar 2008 11:51:43 +0000 Subject: new module to create resolv.conf --- manifests/init.pp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 manifests/init.pp diff --git a/manifests/init.pp b/manifests/init.pp new file mode 100644 index 0000000..50043ae --- /dev/null +++ b/manifests/init.pp @@ -0,0 +1,27 @@ +# modules/resolvconf/manifests/init.pp - manage resolvconf stuff +# Copyright (C) 2007 admin@immerda.ch +# GPLv3 + +# modules_dir { "resolvconf": } + +define resolveconf ( + $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 + } +} + + + -- cgit v1.2.3 From 163a44e5bb5d29e2d4a5bdc94b7e80a25d67f74c Mon Sep 17 00:00:00 2001 From: andreas Date: Mon, 10 Mar 2008 11:53:59 +0000 Subject: resolv.conf für immer1-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- manifests/init.pp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/manifests/init.pp b/manifests/init.pp index 50043ae..e444480 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -4,7 +4,9 @@ # modules_dir { "resolvconf": } -define resolveconf ( +class resolvconf {} + +define resolvconf::create ( $domain='glei.ch', $search='glei.ch', $nameserver1='212.103.67.60', -- cgit v1.2.3 From d8aca73440d02619cfc16d1b9524152fbe603a49 Mon Sep 17 00:00:00 2001 From: andreas Date: Mon, 10 Mar 2008 13:21:57 +0000 Subject: umwandlung in class, und def. von variablen --- manifests/init.pp | 48 ++++++++++++++++++++++++++++++------------------ templates/resolvconf.erb | 8 ++++++++ 2 files changed, 38 insertions(+), 18 deletions(-) create mode 100644 templates/resolvconf.erb 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 %> + -- cgit v1.2.3 From be0237d2bd0944c6673c2f95c1a6fde8a0fc1703 Mon Sep 17 00:00:00 2001 From: andreas Date: Mon, 28 Apr 2008 08:46:47 +0000 Subject: error in resolv.conf template --- templates/resolvconf.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/resolvconf.erb b/templates/resolvconf.erb index 58efe73..5ab3888 100644 --- a/templates/resolvconf.erb +++ b/templates/resolvconf.erb @@ -2,7 +2,7 @@ domain <%= real_resolvconf_domain %> search <%= real_resolvconf_search %> -nameserver1 <%= real_resolvconf_nameserver1 %> -nameserver2 <%= real_resolvconf_nameserver2 %> -nameserver3 <%= real_resolvconf_nameserver3 %> +nameserver <%= real_resolvconf_nameserver1 %> +nameserver <%= real_resolvconf_nameserver2 %> +nameserver <%= real_resolvconf_nameserver3 %> -- cgit v1.2.3 From 433c0fa776449d42894ae5937a35f2bb6b53217a Mon Sep 17 00:00:00 2001 From: andreas Date: Mon, 28 Apr 2008 10:19:54 +0000 Subject: nameservers now as string with ":" as delimiter --- manifests/init.pp | 25 +++++++++++++++---------- templates/resolvconf.erb | 8 +++++--- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 58dc83f..31b41e0 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -13,18 +13,23 @@ class resolvconf { '' => 'glei.ch', default => $resolvconf_search, } - $real_resolvconf_nameserver1 = $resolvconf_nameserver1 ? { - '' => '212.103.67.60', + $real_resolvconf_nameservers ? $resolvconf_nameservers ? { + '' => '212.103.67.60:212.103.67.61:212.103.72.231:192.168.1.104', 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, - } + +# $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', diff --git a/templates/resolvconf.erb b/templates/resolvconf.erb index 5ab3888..c961fc6 100644 --- a/templates/resolvconf.erb +++ b/templates/resolvconf.erb @@ -2,7 +2,9 @@ domain <%= real_resolvconf_domain %> search <%= real_resolvconf_search %> -nameserver <%= real_resolvconf_nameserver1 %> -nameserver <%= real_resolvconf_nameserver2 %> -nameserver <%= real_resolvconf_nameserver3 %> + +<% real_resolvconf_nameservers.split(':').each do |val| -%> +nameserver <%= val %> +<% end -%> + -- cgit v1.2.3 From 741a40c8053e789506c081acae83cf55c5598c24 Mon Sep 17 00:00:00 2001 From: andreas Date: Mon, 28 Apr 2008 10:42:20 +0000 Subject: typo --- manifests/init.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 31b41e0..8891a4e 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -13,9 +13,9 @@ class resolvconf { '' => 'glei.ch', default => $resolvconf_search, } - $real_resolvconf_nameservers ? $resolvconf_nameservers ? { + $real_resolvconf_nameservers = $resolvconf_nameservers ? { '' => '212.103.67.60:212.103.67.61:212.103.72.231:192.168.1.104', - default => $resolvconf_nameserver1, + default => $resolvconf_nameservers, } # $real_resolvconf_nameserver1 = $resolvconf_nameserver1 ? { -- cgit v1.2.3 From 0b4e89569a30268cc1a4ccca0a9a34bdd965acc5 Mon Sep 17 00:00:00 2001 From: andreas Date: Mon, 28 Apr 2008 12:06:28 +0000 Subject: resolv.conf generation for all the config::immerda hosts, some are special --- manifests/init.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/init.pp b/manifests/init.pp index 8891a4e..586275a 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -14,7 +14,7 @@ class resolvconf { default => $resolvconf_search, } $real_resolvconf_nameservers = $resolvconf_nameservers ? { - '' => '212.103.67.60:212.103.67.61:212.103.72.231:192.168.1.104', + '' => '212.103.67.60:212.103.67.61', default => $resolvconf_nameservers, } -- cgit v1.2.3 From e5110b49fb3f61fbe2d707a44051d1e466c0526d Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 28 Apr 2008 13:48:57 +0000 Subject: added debug statement --- manifests/init.pp | 14 +------------- templates/resolvconf.erb | 2 -- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 586275a..3784594 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -13,24 +13,12 @@ class resolvconf { '' => 'glei.ch', default => $resolvconf_search, } + notice("real_resolvconf_nameservers: $real_resolvconf_nameservers") $real_resolvconf_nameservers = $resolvconf_nameservers ? { '' => '212.103.67.60:212.103.67.61', default => $resolvconf_nameservers, } -# $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, diff --git a/templates/resolvconf.erb b/templates/resolvconf.erb index c961fc6..0bc467f 100644 --- a/templates/resolvconf.erb +++ b/templates/resolvconf.erb @@ -6,5 +6,3 @@ search <%= real_resolvconf_search %> <% real_resolvconf_nameservers.split(':').each do |val| -%> nameserver <%= val %> <% end -%> - - -- cgit v1.2.3 From e7dd0f1f09fe761ccc05cef7293ff72a8e083c9f Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 28 Apr 2008 13:53:25 +0000 Subject: fixed debug statement, now correct output --- manifests/init.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/init.pp b/manifests/init.pp index 3784594..178710e 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -13,7 +13,7 @@ class resolvconf { '' => 'glei.ch', default => $resolvconf_search, } - notice("real_resolvconf_nameservers: $real_resolvconf_nameservers") + notice("resolvconf_nameservers: $resolvconf_nameservers") $real_resolvconf_nameservers = $resolvconf_nameservers ? { '' => '212.103.67.60:212.103.67.61', default => $resolvconf_nameservers, -- cgit v1.2.3 From 6a0cd51463ed5170c67aab56fffa31b977dfdb29 Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 28 Apr 2008 14:51:00 +0000 Subject: removed debug statement --- manifests/init.pp | 1 - 1 file changed, 1 deletion(-) diff --git a/manifests/init.pp b/manifests/init.pp index 178710e..fb57059 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -13,7 +13,6 @@ class resolvconf { '' => 'glei.ch', default => $resolvconf_search, } - notice("resolvconf_nameservers: $resolvconf_nameservers") $real_resolvconf_nameservers = $resolvconf_nameservers ? { '' => '212.103.67.60:212.103.67.61', default => $resolvconf_nameservers, -- cgit v1.2.3 From 018232e2117764e636e6fc53ccd65cd4a60c9409 Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 13 Jun 2008 20:26:23 +0000 Subject: merged with puzzle --- files/.git_placeholder | 1 + manifests/init.pp | 21 +++++++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) create mode 100644 files/.git_placeholder diff --git a/files/.git_placeholder b/files/.git_placeholder new file mode 100644 index 0000000..89cb1fe --- /dev/null +++ b/files/.git_placeholder @@ -0,0 +1 @@ +# file needed for git - don't remove it diff --git a/manifests/init.pp b/manifests/init.pp index fb57059..1f5f986 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,6 +1,16 @@ -# modules/resolvconf/manifests/init.pp - manage resolvconf stuff -# Copyright (C) 2007 admin@immerda.ch -# GPLv3 +# +# resolvconf module +# +# Copyright 2008, admin(at)immerda.ch +# Copyright 2008, Puzzle ITC GmbH +# Marcel Härry haerry+puppet(at)puzzle.ch +# Simon Josi josi+puppet(at)puzzle.ch +# +# This program is free software; you can redistribute +# it and/or modify it under the terms of the GNU +# General Public License version 3 as published by +# the Free Software Foundation. +# # modules_dir { "resolvconf": } @@ -25,9 +35,4 @@ class resolvconf { mode => 444, content => template("resolvconf/resolvconf.erb") } - - } - - - -- cgit v1.2.3 From 47ff12dfa9f51e5b3ab948202e795de26388dd19 Mon Sep 17 00:00:00 2001 From: mh Date: Tue, 22 Jul 2008 21:36:08 +0000 Subject: removed placeholder --- files/.git_placeholder | 1 - 1 file changed, 1 deletion(-) delete mode 100644 files/.git_placeholder diff --git a/files/.git_placeholder b/files/.git_placeholder deleted file mode 100644 index 89cb1fe..0000000 --- a/files/.git_placeholder +++ /dev/null @@ -1 +0,0 @@ -# file needed for git - don't remove it -- cgit v1.2.3 From df62da5a8e588444a01207310188f1e05409a117 Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 6 Oct 2008 21:19:04 +0000 Subject: throw away the defaulting immerda specific variables, added a special template for openbsd --- manifests/init.pp | 20 ++++++++++---------- templates/resolvconf.OpenBSD.erb | 5 +++++ templates/resolvconf.erb | 8 ++++---- 3 files changed, 19 insertions(+), 14 deletions(-) create mode 100644 templates/resolvconf.OpenBSD.erb diff --git a/manifests/init.pp b/manifests/init.pp index 1f5f986..a14f01b 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -15,17 +15,14 @@ # modules_dir { "resolvconf": } class resolvconf { - $real_resolvconf_domain = $resolvconf_domain ? { - '' => 'glei.ch', - default => $resolvconf_domain, + case $reseolvconf_domain { + '': { fail("you need to define \$reseolvconf_domain for ${fqdn}") } } - $real_resolvconf_search = $resolvconf_search ? { - '' => 'glei.ch', - default => $resolvconf_search, + $resolvconf_search { + '': { fail("you need to define \$reseolvconf_search for ${fqdn}") } } - $real_resolvconf_nameservers = $resolvconf_nameservers ? { - '' => '212.103.67.60:212.103.67.61', - default => $resolvconf_nameservers, + $resolvconf_nameservers { + '': { fail("you need to define \$reseolvconf_nameservers for ${fqdn}") } } file { '/etc/resolv.conf': @@ -33,6 +30,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 index 0000000..945284e --- /dev/null +++ b/templates/resolvconf.OpenBSD.erb @@ -0,0 +1,5 @@ +# managed by puppet +lookup file bind +<% resolvconf_nameservers.split(':').each do |nameserver| -%> +nameserver <%= nameserver %> +<% end -%> diff --git a/templates/resolvconf.erb b/templates/resolvconf.erb index 0bc467f..f2c17a6 100644 --- a/templates/resolvconf.erb +++ b/templates/resolvconf.erb @@ -1,8 +1,8 @@ # managed by puppet -domain <%= real_resolvconf_domain %> -search <%= real_resolvconf_search %> +domain <%= resolvconf_domain %> +search <%= resolvconf_search %> -<% real_resolvconf_nameservers.split(':').each do |val| -%> -nameserver <%= val %> +<% resolvconf_nameservers.split(':').each do |nameserver| -%> +nameserver <%= nameserver %> <% end -%> -- cgit v1.2.3 From 2acf8f5b6df43b086bd40bd4005aa091b320541e Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 6 Oct 2008 21:24:03 +0000 Subject: fixed typo --- manifests/init.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index a14f01b..71a9db8 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -18,10 +18,10 @@ class resolvconf { case $reseolvconf_domain { '': { fail("you need to define \$reseolvconf_domain for ${fqdn}") } } - $resolvconf_search { + case $resolvconf_search { '': { fail("you need to define \$reseolvconf_search for ${fqdn}") } } - $resolvconf_nameservers { + case $resolvconf_nameservers { '': { fail("you need to define \$reseolvconf_nameservers for ${fqdn}") } } -- cgit v1.2.3 From 0c85c90c1e344ae8b4d73afaf4fdf0a433af1191 Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 6 Oct 2008 21:27:43 +0000 Subject: only check if it is really needed --- manifests/init.pp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 71a9db8..c55781a 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -15,11 +15,16 @@ # modules_dir { "resolvconf": } class resolvconf { - case $reseolvconf_domain { - '': { fail("you need to define \$reseolvconf_domain for ${fqdn}") } - } - case $resolvconf_search { - '': { fail("you need to define \$reseolvconf_search for ${fqdn}") } + case $operatingsystem { + openbsd: { info("\$reseolvconf_domain and \$reseolvconf_search not needed on openbsd") } + default: { + case $reseolvconf_domain { + '': { fail("you need to define \$reseolvconf_domain for ${fqdn}") } + } + case $resolvconf_search { + '': { fail("you need to define \$reseolvconf_search for ${fqdn}") } + } + } } case $resolvconf_nameservers { '': { fail("you need to define \$reseolvconf_nameservers for ${fqdn}") } -- cgit v1.2.3 From 717ec7c54da8d4bd66acd6c5b70504087601529a Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 6 Oct 2008 21:35:46 +0000 Subject: fixed typos --- manifests/init.pp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index c55781a..97423f4 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -16,18 +16,18 @@ class resolvconf { case $operatingsystem { - openbsd: { info("\$reseolvconf_domain and \$reseolvconf_search not needed on openbsd") } + openbsd: { info("\$resolvconf_domain and \$resolvconf_search not needed on openbsd") } default: { - case $reseolvconf_domain { - '': { fail("you need to define \$reseolvconf_domain for ${fqdn}") } + case $resolvconf_domain { + '': { fail("you need to define \$resolvconf_domain for ${fqdn}") } } case $resolvconf_search { - '': { fail("you need to define \$reseolvconf_search for ${fqdn}") } + '': { fail("you need to define \$resolvconf_search for ${fqdn}") } } } } case $resolvconf_nameservers { - '': { fail("you need to define \$reseolvconf_nameservers for ${fqdn}") } + '': { fail("you need to define \$resolvconf_nameservers for ${fqdn}") } } file { '/etc/resolv.conf': -- cgit v1.2.3 From 1c77a21234e5ba32f4a7c03c727e3e20119784c3 Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 22 May 2009 23:33:19 +0200 Subject: now new additional lines --- templates/resolvconf.OpenBSD.erb | 4 ++-- templates/resolvconf.erb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/resolvconf.OpenBSD.erb b/templates/resolvconf.OpenBSD.erb index 945284e..27c2a69 100644 --- a/templates/resolvconf.OpenBSD.erb +++ b/templates/resolvconf.OpenBSD.erb @@ -1,5 +1,5 @@ # managed by puppet lookup file bind -<% resolvconf_nameservers.split(':').each do |nameserver| -%> +<%- resolvconf_nameservers.split(':').each do |nameserver| -%> nameserver <%= nameserver %> -<% end -%> +<%- end -%> diff --git a/templates/resolvconf.erb b/templates/resolvconf.erb index f2c17a6..ca7bce7 100644 --- a/templates/resolvconf.erb +++ b/templates/resolvconf.erb @@ -3,6 +3,6 @@ domain <%= resolvconf_domain %> search <%= resolvconf_search %> -<% resolvconf_nameservers.split(':').each do |nameserver| -%> +<%- resolvconf_nameservers.split(':').each do |nameserver| -%> nameserver <%= nameserver %> -<% end -%> +<%- end -%> -- cgit v1.2.3