aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Jeanneret <cedric.jeanneret@camptocamp.com>2011-06-22 10:52:53 +0200
committerCédric Jeanneret <cedric.jeanneret@camptocamp.com>2011-06-22 10:52:53 +0200
commitb2f56872e2e8ad9a0b2fa4e7d08eb888638d286f (patch)
tree891c8f1f258282d9c31f0702914fc3deb92f31c8
parent65fe9001efdbcc2ab28816bd0ab1298dea610faa (diff)
downloadpuppet-dhcp-b2f56872e2e8ad9a0b2fa4e7d08eb888638d286f.tar.gz
puppet-dhcp-b2f56872e2e8ad9a0b2fa4e7d08eb888638d286f.tar.bz2
dhcp::subnet - added new argument, and updated related template
-rw-r--r--manifests/definitions/dhcp-subnet.pp23
-rw-r--r--templates/subnet.conf.erb1
2 files changed, 20 insertions, 4 deletions
diff --git a/manifests/definitions/dhcp-subnet.pp b/manifests/definitions/dhcp-subnet.pp
index 066f538..c0f865b 100644
--- a/manifests/definitions/dhcp-subnet.pp
+++ b/manifests/definitions/dhcp-subnet.pp
@@ -10,6 +10,7 @@ Arguments:
*$subnet_mask* : netmask sent to dhcp guests (if not set, takes $netmask, or netmask_eth0)
*$domain_name* : subnet domain name (if not set, takes server domain)
*$other_opts* : any other DHCPD option, as an array
+ *$is_shared* : whether it's part of a shared network or not. Default: false
Example:
@@ -32,7 +33,8 @@ define dhcp::subnet(
$routers=false,
$subnet_mask=false,
$domain_name=false,
- $other_opts=false) {
+ $other_opts=false,
+ $is_shared=false) {
include dhcp::params
$to_include = "${dhcp::params::config_dir}/hosts.d/${name}.conf"
@@ -45,10 +47,25 @@ define dhcp::subnet(
notify => Service["dhcpd"],
}
- common::concatfilepart {"dhcp.${name}":
+ if ! $is_shared {
+ common::concatfilepart {"dhcp.${name}":
+ file => "${dhcp::params::config_dir}/dhcpd.conf",
+ ensure => $ensure,
+ content => "include \"${dhcp::params::config_dir}/subnets/${name}.conf\";\n",
+ }
+ } else {
+ common::concatfilepart {"dhcp.${name}":
+ file => "${dhcp::params::config_dir}/dhcpd.conf",
+ ensure => absent,
+ content => "include \"${dhcp::params::config_dir}/subnets/${name}.conf\";\n",
+ }
+
+ }
+
+ common::concatfilepart {"subnet.${name}.hosts":
file => "${dhcp::params::config_dir}/dhcpd.conf",
ensure => $ensure,
- content => "include \"${dhcp::params::config_dir}/subnets/${name}.conf\";\n",
+ content => "include \"${dhcp::params::config_dir}/hosts.d/${name}.conf\";\n",
}
common::concatfilepart {"00.dhcp.${name}.base":
diff --git a/templates/subnet.conf.erb b/templates/subnet.conf.erb
index 95b0660..89ca82f 100644
--- a/templates/subnet.conf.erb
+++ b/templates/subnet.conf.erb
@@ -31,4 +31,3 @@ subnet <%=name%> netmask <%=netmask_eth0%> {
<% end -%>
<% end -%>
}
-include "<%=to_include%>";