aboutsummaryrefslogtreecommitdiff
path: root/manifests/hosts.pp
diff options
context:
space:
mode:
authorJeanneret Cedric <contact@internux.ch>2013-04-10 22:37:10 -0700
committerJeanneret Cedric <contact@internux.ch>2013-04-10 22:37:10 -0700
commit87162a8cc3e47996160f85e1807f75b9ad741bc8 (patch)
treed897d6ab4dd59c94ed40dc3333006a115700ca49 /manifests/hosts.pp
parent5486843f40439050f4aa6a94fab8d2bf45037942 (diff)
parentec52b52f8227e10a3724c21dde337a424bdcfe27 (diff)
downloadpuppet-dhcp-87162a8cc3e47996160f85e1807f75b9ad741bc8.tar.gz
puppet-dhcp-87162a8cc3e47996160f85e1807f75b9ad741bc8.tar.bz2
Merge pull request #4 from cjeanneret/hosts-uses-hashes
Hosts uses hashes
Diffstat (limited to 'manifests/hosts.pp')
-rw-r--r--manifests/hosts.pp52
1 files changed, 52 insertions, 0 deletions
diff --git a/manifests/hosts.pp b/manifests/hosts.pp
new file mode 100644
index 0000000..b159449
--- /dev/null
+++ b/manifests/hosts.pp
@@ -0,0 +1,52 @@
+# = Definition: dhcp::hosts
+#
+# Creates a dhcp configuration for given hosts
+#
+# Arguments
+# $template: dhcp host template - default: 'dhcp/host.conf.erb'
+# $global_options: global options for the whole bunch of hosts.
+# you may override it per host, setting the host "options"
+# directly in the hash.
+# $subnet: targeted subnet
+# $hash_data: hash containing data - default form:
+# {
+# <host1> => {
+# options => false,
+# fixed_address => false,
+# interfaces => {
+# eth0 => 'mac-address',
+# eth1 => 'mac-address',
+# wlan0 => 'mac-address',
+# wlan1 => 'mac-address',
+# …,
+# }
+# },
+# <host2> => {
+# options => false,
+# fixed_address => false,
+# interfaces => {
+# eth0 => 'mac-address',
+# eth1 => 'mac-address',
+# wlan0 => 'mac-address',
+# wlan1 => 'mac-address',
+# …,
+# }
+# },
+# …,
+# }
+#
+define dhcp::hosts (
+ $hash_data,
+ $subnet,
+ $global_options = false,
+ $template = 'dhcp/host.conf.erb',
+) {
+
+ include dhcp::params
+
+ concat::fragment {"dhcp.host.${name}":
+ target => "${dhcp::params::config_dir}/hosts.d/${subnet}.conf",
+ content => template($template),
+ notify => Service['dhcpd'],
+ }
+}