aboutsummaryrefslogtreecommitdiff
path: root/manifests/classes
diff options
context:
space:
mode:
Diffstat (limited to 'manifests/classes')
-rw-r--r--manifests/classes/dhcp-base.pp51
-rw-r--r--manifests/classes/dhcp-debian.pp24
-rw-r--r--manifests/classes/dhcp-variables.pp22
-rw-r--r--manifests/classes/dhcp.pp43
4 files changed, 140 insertions, 0 deletions
diff --git a/manifests/classes/dhcp-base.pp b/manifests/classes/dhcp-base.pp
new file mode 100644
index 0000000..4e1497e
--- /dev/null
+++ b/manifests/classes/dhcp-base.pp
@@ -0,0 +1,51 @@
+/*
+
+= Class dhcp::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::$operatingsystem.
+
+*/
+class dhcp::base {
+ include dhcp::variables
+ package {"dhcp-server":
+ ensure => present,
+ name => $dhcp::variables::srv_dhcpd,
+ }
+
+ service {"dhcpd":
+ name => $dhcp::variables::srv_dhcpd,
+ ensure => running,
+ enable => true,
+ require => Package["dhcp-server"],
+ }
+
+ common::concatfilepart {"00-base":
+ file => "${dhcp::variables::config_dir}/dhcpd.conf",
+ ensure => present,
+ require => Package["dhcp-server"],
+ notify => Service["dhcpd"],
+ }
+
+ file {"subnet-config-dir":
+ path => "${dhcp::variables::config_dir}/subnets",
+ ensure => directory,
+ require => Package["dhcp-server"],
+ notify => Service["dhcpd"],
+ recurse => true,
+ purge => true,
+ force => true,
+ source => "puppet:///dhcp/empty"
+ }
+
+ file {"dhcp-config-dir":
+ path => "${dhcp::variables::config_dir}/hosts.d",
+ ensure => directory,
+ require => Package["dhcp-server"],
+ recurse => true,
+ purge => true,
+ force => true,
+ source => "puppet:///dhcp/empty"
+ }
+
+}
diff --git a/manifests/classes/dhcp-debian.pp b/manifests/classes/dhcp-debian.pp
new file mode 100644
index 0000000..1d35cbc
--- /dev/null
+++ b/manifests/classes/dhcp-debian.pp
@@ -0,0 +1,24 @@
+/*
+
+= Class: dhcp::debian
+Installs a dhcp server on debian system.
+
+This class should not be included as is, please include "dhcp" instead.
+
+*/
+class dhcp::debian inherits dhcp::base {
+
+ Common::Concatfilepart["00-base"] {
+ content => $lsbdistcodename ? {
+ squeeze => template('dhcp/dhcpd.conf.squeeze.erb'),
+ lenny => template('dhcp/dhcpd.conf.lenny.erb'),
+ }
+ }
+
+ Service["dhcpd"] {
+ pattern => $lsbdistcodename ? {
+ squeeze => "/usr/sbin/dhcpd",
+ lenny => "/usr/sbin/dhcpd3",
+ }
+ }
+}
diff --git a/manifests/classes/dhcp-variables.pp b/manifests/classes/dhcp-variables.pp
new file mode 100644
index 0000000..e189ae6
--- /dev/null
+++ b/manifests/classes/dhcp-variables.pp
@@ -0,0 +1,22 @@
+/*
+
+= Class: dhcp::variables
+Do NOT include this class - it won't do anything.
+Set variables for names and paths
+
+*/
+class dhcp::variables {
+ case $operatingsystem {
+ Debian: {
+ $config_dir = $lsbdistcodename? {
+ lenny => "/etc/dhcp3",
+ squeeze => "/etc/dhcp",
+ }
+
+ $srv_dhcpd = $lsbdistcodename? {
+ lenny => "dhcp3-server",
+ squeeze => "isc-dhcp-server",
+ }
+ }
+ }
+}
diff --git a/manifests/classes/dhcp.pp b/manifests/classes/dhcp.pp
new file mode 100644
index 0000000..9ae7b9f
--- /dev/null
+++ b/manifests/classes/dhcp.pp
@@ -0,0 +1,43 @@
+/*
+
+= Class: dhcp
+Simple OS wrapper. Include this to install a dhcp server on your host.
+
+Requires:
+ module "common": git://github.com/camptocamp/puppet-common.git
+
+Required arguments:
+ *$dhcpd_domain_name*: domain-name option
+ *$dhcpd_dns_servers*: domain-name-servers option
+
+facultative argument:
+ *$dhcpd_ddns_update*: ddns-update-style option
+ *$dhcpd_ddns_authoritative*: set it if you want that your DHCP server is authoritative
+
+Example:
+node "dhcp.toto.ltd" {
+ $dhcpd_domain_name = 'toto.ltd'
+ $dhcpd_dns_servers = '192.168.21.1'
+ include dhcp
+
+ dhcp::subnet {"192.168.20.0":
+ ensure => present,
+ bcast => "192.168.20.255",
+ dns => "192.168.21.1, 10.26.22.1",
+ other_opt => ['filename "pxelinux.0";', 'next-server 192.168.10.1;'],
+ inc => true,
+ }
+
+ dhcp::host {"titi-eth0":
+ ensure => present,
+ mac => "0e:18:fa:fe:d9:00",
+ subnet => "192.168.20.0",
+ fixed_address => "192.168.10.52",
+ }
+}
+*/
+class dhcp {
+ case $operatingsystem {
+ Debian: { include dhcp::debian }
+ }
+}