summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormh <mh@immerda.ch>2011-09-06 23:00:03 +0200
committermh <mh@immerda.ch>2011-09-06 23:00:03 +0200
commit65bab32e5860c4409737dc01035299a9d4a98a62 (patch)
tree55f2dd18ec024a7b4a8491e42cd91bb31f3594af
parent5fa34ec0c8d3c996c4bf36fc685433e24a99e1d3 (diff)
downloadpuppet-resolvconf-65bab32e5860c4409737dc01035299a9d4a98a62.tar.gz
puppet-resolvconf-65bab32e5860c4409737dc01035299a9d4a98a62.tar.bz2
use hiera for variables
-rw-r--r--manifests/init.pp19
-rw-r--r--templates/resolvconf.erb7
2 files changed, 5 insertions, 21 deletions
diff --git a/manifests/init.pp b/manifests/init.pp
index 68c3eb5..257fa19 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -13,28 +13,11 @@
#
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;
}
}
diff --git a/templates/resolvconf.erb b/templates/resolvconf.erb
index 0c274a6..dc98aea 100644
--- a/templates/resolvconf.erb
+++ b/templates/resolvconf.erb
@@ -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 -%>