]> gitweb.fluxo.info Git - puppet-dhcp.git/commitdiff
dhcp::subnet - added new argument, and updated related template
authorCédric Jeanneret <cedric.jeanneret@camptocamp.com>
Wed, 22 Jun 2011 08:52:53 +0000 (10:52 +0200)
committerCédric Jeanneret <cedric.jeanneret@camptocamp.com>
Wed, 22 Jun 2011 08:52:53 +0000 (10:52 +0200)
manifests/definitions/dhcp-subnet.pp
templates/subnet.conf.erb

index 066f53893755cc0d7265661f44e85e299f107802..c0f865bd7bf512466e89e11c6f51fa53098abaa0 100644 (file)
@@ -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":
index 95b066002b8d408aa7ae3268b27a157a7decb024..89ca82fb697905035979e0d699a650e3faedd9c1 100644 (file)
@@ -31,4 +31,3 @@ subnet <%=name%> netmask <%=netmask_eth0%> {
   <% end -%>
 <% end -%>
 }
-include "<%=to_include%>";