aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--manifests/params.pp4
-rw-r--r--manifests/server/config.pp13
-rw-r--r--manifests/server/packages.pp7
-rw-r--r--manifests/server/service.pp9
4 files changed, 28 insertions, 5 deletions
diff --git a/manifests/params.pp b/manifests/params.pp
index 20fbcd2..925f3f5 100644
--- a/manifests/params.pp
+++ b/manifests/params.pp
@@ -1,4 +1,4 @@
-# = Class: dhcp::params
+# Class: dhcp::params
#
# Do NOT include this class - it won't do anything.
# Set variables for names and paths
@@ -23,7 +23,7 @@ class dhcp::params {
squeeze => '/usr/sbin/dhcpd',
}
- $base_template = 'dhcp/dhcpd.conf.debian.erb'
+ $server_template = "${module_name}/dhcpd.conf.debian.erb"
}
default: {
diff --git a/manifests/server/config.pp b/manifests/server/config.pp
index c37d044..4898a60 100644
--- a/manifests/server/config.pp
+++ b/manifests/server/config.pp
@@ -1,7 +1,16 @@
+# Class: dhcp::server::config
+#
+# Configure the DHCP server
+#
class dhcp::server::config {
include ::dhcp::params
include ::concat::setup
+ validate_string($dhcp::params::config_dir)
+ validate_absolute_path($dhcp::params::config_dir)
+ validate_string($dhcp::params::server_template)
+ validate_re($dhcp::params::server_template, '^\S+$')
+
concat {"${dhcp::params::config_dir}/dhcpd.conf":
owner => root,
group => root,
@@ -11,7 +20,7 @@ class dhcp::server::config {
concat::fragment {'00.dhcp.server.base':
ensure => present,
target => "${dhcp::params::config_dir}/dhcpd.conf",
- content => template($dhcp::params::base_template),
+ content => template($dhcp::params::server_template),
}
file {"${dhcp::params::config_dir}/dhcpd.conf.d":
@@ -29,8 +38,6 @@ class dhcp::server::config {
purge => true,
force => true,
source => "puppet:///modules/${module_name}/empty",
- require => Package['dhcp-server'],
- notify => Service['dhcpd'],
}
file {"${dhcp::params::config_dir}/hosts.d":
diff --git a/manifests/server/packages.pp b/manifests/server/packages.pp
index 34751e8..b89ede3 100644
--- a/manifests/server/packages.pp
+++ b/manifests/server/packages.pp
@@ -1,6 +1,13 @@
+# Class: dhcp::server::packages
+#
+# Install the DHCP server
+#
class dhcp::server::packages {
include ::dhcp::params
+ validate_string($dhcp::params::srv_dhcpd)
+ validate_re($dhcp::params::srv_dhcpd, '^\S+$')
+
package {'dhcp-server':
ensure => present,
name => $dhcp::params::srv_dhcpd,
diff --git a/manifests/server/service.pp b/manifests/server/service.pp
index d531a7d..ef016c5 100644
--- a/manifests/server/service.pp
+++ b/manifests/server/service.pp
@@ -1,6 +1,15 @@
+# Class: dhcp::server::service
+#
+# Manage the DHCP server service
+#
class dhcp::server::service {
include ::dhcp::params
+ validate_string($dhcp::params::srv_dhcpd)
+ validate_re($dhcp::params::srv_dhcpd, '^\S+$')
+ validate_string($dhcp::params::service_pattern)
+ validate_re($dhcp::params::service_pattern, '^\S+$')
+
service {'dhcpd':
ensure => running,
name => $dhcp::params::srv_dhcpd,