diff options
Diffstat (limited to 'manifests')
-rw-r--r-- | manifests/init.pp | 7 | ||||
-rw-r--r-- | manifests/params.pp | 7 | ||||
-rw-r--r-- | manifests/server.pp | 6 | ||||
-rw-r--r-- | manifests/server/config.pp (renamed from manifests/server/base.pp) | 36 | ||||
-rw-r--r-- | manifests/server/debian.pp | 21 | ||||
-rw-r--r-- | manifests/server/packages.pp | 8 | ||||
-rw-r--r-- | manifests/server/service.pp | 10 |
7 files changed, 42 insertions, 53 deletions
diff --git a/manifests/init.pp b/manifests/init.pp new file mode 100644 index 0000000..8a14b13 --- /dev/null +++ b/manifests/init.pp @@ -0,0 +1,7 @@ +class dhcp ( + $server = true, +) { + if $server { + class { '::dhcp::server': } + } +} diff --git a/manifests/params.pp b/manifests/params.pp index d2ba584..20fbcd2 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -17,6 +17,13 @@ class dhcp::params { lenny => 'dhcp3-server', squeeze => 'isc-dhcp-server', } + + $service_pattern = $::lsbdistcodename? { + lenny => '/usr/sbin/dhcpd3', + squeeze => '/usr/sbin/dhcpd', + } + + $base_template = 'dhcp/dhcpd.conf.debian.erb' } default: { diff --git a/manifests/server.pp b/manifests/server.pp index 6bdf51f..779b305 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -33,7 +33,7 @@ node "dhcp.toto.ltd" { */ class dhcp::server { - case $::operatingsystem { - Debian: { include dhcp::server::debian } - } + class { '::dhcp::server::packages': } -> + class { '::dhcp::server::config': } ~> + class { '::dhcp::server::service': } } diff --git a/manifests/server/base.pp b/manifests/server/config.pp index 4e7d645..c37d044 100644 --- a/manifests/server/base.pp +++ b/manifests/server/config.pp @@ -1,25 +1,6 @@ -# = 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'], - } +class dhcp::server::config { + include ::dhcp::params + include ::concat::setup concat {"${dhcp::params::config_dir}/dhcpd.conf": owner => root, @@ -30,8 +11,7 @@ class dhcp::server::base { concat::fragment {'00.dhcp.server.base': ensure => present, target => "${dhcp::params::config_dir}/dhcpd.conf", - require => Package['dhcp-server'], - notify => Service['dhcpd'], + content => template($dhcp::params::base_template), } file {"${dhcp::params::config_dir}/dhcpd.conf.d": @@ -40,7 +20,7 @@ class dhcp::server::base { recurse => true, purge => true, force => true, - source => 'puppet:///modules/dhcp/empty' + source => "puppet:///modules/${module_name}/empty" } file {"${dhcp::params::config_dir}/subnets": @@ -48,7 +28,7 @@ class dhcp::server::base { recurse => true, purge => true, force => true, - source => 'puppet:///modules/dhcp/empty', + source => "puppet:///modules/${module_name}/empty", require => Package['dhcp-server'], notify => Service['dhcpd'], } @@ -58,8 +38,6 @@ class dhcp::server::base { recurse => true, purge => true, force => true, - source => 'puppet:///modules/dhcp/empty', - require => Package['dhcp-server'], + 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..34751e8 --- /dev/null +++ b/manifests/server/packages.pp @@ -0,0 +1,8 @@ +class dhcp::server::packages { + include ::dhcp::params + + 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..d531a7d --- /dev/null +++ b/manifests/server/service.pp @@ -0,0 +1,10 @@ +class dhcp::server::service { + include ::dhcp::params + + service {'dhcpd': + ensure => running, + name => $dhcp::params::srv_dhcpd, + enable => true, + pattern => $dhcp::params::service_pattern, + } +} |