diff options
Diffstat (limited to 'manifests/server')
-rw-r--r-- | manifests/server/base.pp | 65 | ||||
-rw-r--r-- | manifests/server/config.pp | 54 | ||||
-rw-r--r-- | manifests/server/debian.pp | 21 | ||||
-rw-r--r-- | manifests/server/packages.pp | 15 | ||||
-rw-r--r-- | manifests/server/service.pp | 19 |
5 files changed, 88 insertions, 86 deletions
diff --git a/manifests/server/base.pp b/manifests/server/base.pp deleted file mode 100644 index 4e7d645..0000000 --- a/manifests/server/base.pp +++ /dev/null @@ -1,65 +0,0 @@ -# = Class dhcp::server::base -# -# Do NOT include this class - it won't work at all. -# Set variables for package name and so on. -# This class should be inherited in dhcp::server::$operatingsystem. -# -class dhcp::server::base { - - include dhcp::params - include concat::setup - - package {'dhcp-server': - ensure => present, - name => $dhcp::params::srv_dhcpd, - } - - service {'dhcpd': - ensure => running, - name => $dhcp::params::srv_dhcpd, - enable => true, - require => Package['dhcp-server'], - } - - concat {"${dhcp::params::config_dir}/dhcpd.conf": - owner => root, - group => root, - mode => '0644', - } - - concat::fragment {'00.dhcp.server.base': - ensure => present, - target => "${dhcp::params::config_dir}/dhcpd.conf", - require => Package['dhcp-server'], - notify => Service['dhcpd'], - } - - file {"${dhcp::params::config_dir}/dhcpd.conf.d": - ensure => directory, - mode => '0700', - recurse => true, - purge => true, - force => true, - source => 'puppet:///modules/dhcp/empty' - } - - file {"${dhcp::params::config_dir}/subnets": - ensure => directory, - recurse => true, - purge => true, - force => true, - source => 'puppet:///modules/dhcp/empty', - require => Package['dhcp-server'], - notify => Service['dhcpd'], - } - - file {"${dhcp::params::config_dir}/hosts.d": - ensure => directory, - recurse => true, - purge => true, - force => true, - source => 'puppet:///modules/dhcp/empty', - require => Package['dhcp-server'], - } - -} diff --git a/manifests/server/config.pp b/manifests/server/config.pp new file mode 100644 index 0000000..0c1a74a --- /dev/null +++ b/manifests/server/config.pp @@ -0,0 +1,54 @@ +# 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+$') + + validate_string($dhcp::server::ddns_update) + validate_bool($dhcp::server::authoritative) + validate_array($dhcp::server::opts) + + concat {"${dhcp::params::config_dir}/dhcpd.conf": + owner => root, + group => root, + mode => '0644', + } + + concat::fragment {'00.dhcp.server.base': + ensure => present, + target => "${dhcp::params::config_dir}/dhcpd.conf", + content => template($dhcp::params::server_template), + } + + file {"${dhcp::params::config_dir}/dhcpd.conf.d": + ensure => directory, + mode => '0700', + recurse => true, + purge => true, + force => true, + source => "puppet:///modules/${module_name}/empty" + } + + file {"${dhcp::params::config_dir}/subnets": + ensure => directory, + recurse => true, + purge => true, + force => true, + source => "puppet:///modules/${module_name}/empty", + } + + file {"${dhcp::params::config_dir}/hosts.d": + ensure => directory, + recurse => true, + purge => true, + force => true, + source => "puppet:///modules/${module_name}/empty", + } +} diff --git a/manifests/server/debian.pp b/manifests/server/debian.pp deleted file mode 100644 index 5d23bbe..0000000 --- a/manifests/server/debian.pp +++ /dev/null @@ -1,21 +0,0 @@ -# = Class: dhcp::server::debian -# -# Installs a dhcp server on debian system. -# -# This class should not be included as is, -# please include "dhcp::server" instead. -# -class dhcp::server::debian inherits dhcp::server::base { - - Concat::Fragment['00.dhcp.server.base'] { - content => template('dhcp/dhcpd.conf.debian.erb'), - } - - Service['dhcpd'] { - pattern => $::lsbdistcodename ? { - squeeze => '/usr/sbin/dhcpd', - lenny => '/usr/sbin/dhcpd3', - } - } - -} diff --git a/manifests/server/packages.pp b/manifests/server/packages.pp new file mode 100644 index 0000000..b89ede3 --- /dev/null +++ b/manifests/server/packages.pp @@ -0,0 +1,15 @@ +# 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 new file mode 100644 index 0000000..ef016c5 --- /dev/null +++ b/manifests/server/service.pp @@ -0,0 +1,19 @@ +# 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, + enable => true, + pattern => $dhcp::params::service_pattern, + } +} |