aboutsummaryrefslogtreecommitdiff
path: root/manifests/definitions
diff options
context:
space:
mode:
authorCédric Jeanneret <cedric.jeanneret@camptocamp.com>2010-11-04 14:02:31 +0100
committerCédric Jeanneret <cedric.jeanneret@camptocamp.com>2010-11-04 14:02:31 +0100
commit68b0642c21a598b6f5aecfedd38cc1584737fbec (patch)
treefdbedfe6246b9bb467fe125097ccaf36abf4c892 /manifests/definitions
downloadpuppet-dhcp-68b0642c21a598b6f5aecfedd38cc1584737fbec.tar.gz
puppet-dhcp-68b0642c21a598b6f5aecfedd38cc1584737fbec.tar.bz2
New module: dhcp
Install and manage a dhcp server with puppet. Please read manifests/classes/dhcp.pp for more informations about usage.
Diffstat (limited to 'manifests/definitions')
-rw-r--r--manifests/definitions/dhcp-host.pp10
-rw-r--r--manifests/definitions/dhcp-subnet.pp33
2 files changed, 43 insertions, 0 deletions
diff --git a/manifests/definitions/dhcp-host.pp b/manifests/definitions/dhcp-host.pp
new file mode 100644
index 0000000..747fa7c
--- /dev/null
+++ b/manifests/definitions/dhcp-host.pp
@@ -0,0 +1,10 @@
+define dhcp::host($ensure=present,$mac,$subnet,$fixed_address=false) {
+ include dhcp::variables
+ common::concatfilepart {$name:
+ ensure => $ensure,
+ notify => Service["dhcpd"],
+ file => "${dhcp::variables::config_dir}/hosts.d/${subnet}.conf",
+ require => Dhcp::Subnet[$subnet],
+ content => template("dhcp/host.conf.erb"),
+ }
+}
diff --git a/manifests/definitions/dhcp-subnet.pp b/manifests/definitions/dhcp-subnet.pp
new file mode 100644
index 0000000..46c55ae
--- /dev/null
+++ b/manifests/definitions/dhcp-subnet.pp
@@ -0,0 +1,33 @@
+define dhcp::subnet(
+ $ensure=present,
+ $bcast,
+ $dns,
+ $netmask=false,
+ $domain_name=false,
+ $inc=false,
+ $routeurs=false,
+ $netbios_dns=false,
+ $subnet_mask=false,
+ $other_opt=false,
+ $deny=false) {
+ include dhcp::variables
+
+ if $inc {
+ $to_inc = "${dhcp::variables::config_dir}/hosts.d/${name}.conf"
+ }
+
+ file {"${dhcp::variables::config_dir}/subnets/${name}.conf":
+ ensure => $ensure,
+ owner => root,
+ group => root,
+ content => template("dhcp/subnet.conf.erb"),
+ notify => Service["dhcpd"],
+ }
+
+ common::concatfilepart {"${name}":
+ file => "${dhcp::variables::config_dir}/dhcpd.conf",
+ ensure => $ensure,
+ content => "include \"${dhcp::variables::config_dir}/subnets/${name}.conf\";\n",
+ }
+
+}