]> gitweb.fluxo.info Git - puppet-dhcp.git/commitdiff
dhcp - new definition and related template: shared-network
authorCédric Jeanneret <cedric.jeanneret@camptocamp.com>
Wed, 22 Jun 2011 08:52:27 +0000 (10:52 +0200)
committerCédric Jeanneret <cedric.jeanneret@camptocamp.com>
Wed, 22 Jun 2011 08:52:27 +0000 (10:52 +0200)
manifests/definitions/dhcp-shared-network.pp [new file with mode: 0644]
templates/shared-network.erb [new file with mode: 0644]

diff --git a/manifests/definitions/dhcp-shared-network.pp b/manifests/definitions/dhcp-shared-network.pp
new file mode 100644 (file)
index 0000000..9e1e779
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+
+== Definition: dhcp::shared-network
+Creates a shared-network
+
+Arguments:
+  *$subnets* : subnet list to be included in the shared-network
+
+Warnings:
+- subnets must exists
+- subnets must have $is_shared set to true (default is false)
+
+*/
+define dhcp::shared-network($ensure=present, $subnets=[]) {
+  include dhcp::params
+  common::concatfilepart {"shared-${name}":
+    ensure  => $ensure,
+    file    => "${dhcp::params::config_dir}/dhcpd.conf",
+    content => template("dhcp/shared-network.erb"),
+    require => Dhcp::Subnet[$subnets],
+  }
+}
diff --git a/templates/shared-network.erb b/templates/shared-network.erb
new file mode 100644 (file)
index 0000000..99a7aca
--- /dev/null
@@ -0,0 +1,7 @@
+#### dhcp::shared-network <%= name %>
+shared-network <%= name %> {
+<% subnets.each do |subnet| -%>
+  include "<%= scope.lookupvar("dhcp::params::config_dir") %>/subnets/<%= subnet %>.conf";
+<% end -%>
+}
+#### END <%= name %>