aboutsummaryrefslogtreecommitdiff
path: root/manifests/shared_network.pp
diff options
context:
space:
mode:
authorRaphaël Pinson <raphael.pinson@camptocamp.com>2013-04-14 23:50:03 -0700
committerRaphaël Pinson <raphael.pinson@camptocamp.com>2013-04-14 23:50:03 -0700
commit93895f1f039956ec9d02df511aaeaed885ae34bf (patch)
tree704909c98dc11bb9206b2c67f3f8557418507a21 /manifests/shared_network.pp
parent87162a8cc3e47996160f85e1807f75b9ad741bc8 (diff)
parentc0f46562b70777b9a4a39429d94c49e869150c64 (diff)
downloadpuppet-dhcp-93895f1f039956ec9d02df511aaeaed885ae34bf.tar.gz
puppet-dhcp-93895f1f039956ec9d02df511aaeaed885ae34bf.tar.bz2
Merge pull request #5 from raphink/dev/cleanup
Cleanup, refactor…
Diffstat (limited to 'manifests/shared_network.pp')
-rw-r--r--manifests/shared_network.pp40
1 files changed, 40 insertions, 0 deletions
diff --git a/manifests/shared_network.pp b/manifests/shared_network.pp
new file mode 100644
index 0000000..766f432
--- /dev/null
+++ b/manifests/shared_network.pp
@@ -0,0 +1,40 @@
+# Definition: dhcp::shared-network
+#
+# Creates a shared-network
+#
+# Parameters:
+# ['subnets'] - An array of subnets to be included in the shared-network.
+#
+# Sample usage:
+# ::dhcp::shared_network { 'office':
+# subnets => ['192.168.1.0', '192.168.2.0'],
+# }
+#
+# Requires:
+# - puppetlabs/stdlib
+# - ripienaar/concat
+#
+# 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
+
+ validate_string($ensure)
+ validate_re($ensure, ['present', 'absent'],
+ "\$ensure must be either 'present' or 'absent', got '${ensure}'")
+ validate_array($subnets)
+
+ concat::fragment {"dhcp-shared-${name}":
+ ensure => $ensure,
+ target => "${dhcp::params::config_dir}/dhcpd.conf",
+ content => template("${module_name}/shared-network.erb"),
+ require => Dhcp::Subnet[$subnets],
+ }
+
+}