From f0e9bb998b56fe42a7d25eacf43591d4b922cb89 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sun, 31 Mar 2013 20:25:34 -0300 Subject: Parametrize dhclient class --- manifests/subsystems/dhclient.pp | 9 ++++++--- templates/dhcp/dhclient.conf.erb | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/manifests/subsystems/dhclient.pp b/manifests/subsystems/dhclient.pp index 7c4ebf4..b901d2b 100644 --- a/manifests/subsystems/dhclient.pp +++ b/manifests/subsystems/dhclient.pp @@ -1,10 +1,13 @@ -class dhclient { +class dhclient( + $ensure = hiera('nodo::dhclient::manage', 'present'), + $supersede_domain = hiera('nodo::dhclient::supersede_domain', '') +) { package { 'isc-dhcp-client': - ensure => present, + ensure => $ensure, } file { '/etc/dhcp/dhclient.conf': - ensure => present, + ensure => $ensure, owner => root, group => root, mode => 0644, diff --git a/templates/dhcp/dhclient.conf.erb b/templates/dhcp/dhclient.conf.erb index 39eeeb5..dfc465d 100644 --- a/templates/dhcp/dhclient.conf.erb +++ b/templates/dhcp/dhclient.conf.erb @@ -18,9 +18,11 @@ option rfc3442-classless-static-routes code 121 = array of unsigned integer 8; #send dhcp-lease-time 3600; #prepend domain-name-servers 127.0.0.1; +<%- if $supersede_domain != '' then -%> # Force a domain name, otherwise facter and other configurations might break. supersede domain-name "<%= domain %>"; supersede domain-search "<%= domain %>"; +<%- end -%> request subnet-mask, broadcast-address, time-offset, routers, domain-name, domain-name-servers, domain-search, host-name, -- cgit v1.2.3