aboutsummaryrefslogtreecommitdiff
path: root/manifests
diff options
context:
space:
mode:
authorCédric Jeanneret <cedric.jeanneret@camptocamp.com>2015-10-30 13:57:27 +0100
committerCédric Jeanneret <cedric.jeanneret@camptocamp.com>2015-11-02 08:26:43 +0100
commitca9bfad600ffaa0eb37533c9d86c9912ad35d833 (patch)
treed203cc17b4fa7e999661f5b662e63daacdc9f23f /manifests
parent3f54f2046f95841a47201b678928a7f436bf182c (diff)
downloadpuppet-dhcp-ca9bfad600ffaa0eb37533c9d86c9912ad35d833.tar.gz
puppet-dhcp-ca9bfad600ffaa0eb37533c9d86c9912ad35d833.tar.bz2
added new dhcp::failover, related unit-test and updated doc
Diffstat (limited to 'manifests')
-rw-r--r--manifests/failover.pp41
1 files changed, 41 insertions, 0 deletions
diff --git a/manifests/failover.pp b/manifests/failover.pp
new file mode 100644
index 0000000..6b465f2
--- /dev/null
+++ b/manifests/failover.pp
@@ -0,0 +1,41 @@
+define dhcp::failover(
+ $peer_address,
+ $ensure = present,
+ $address = $::ipaddress,
+ $peer_port = 647,
+ $port = 647,
+ $options = {},
+ $role = 'primary',
+) {
+
+ validate_re($ensure, ['present', 'absent'])
+ validate_ipv4_address($address)
+ validate_ipv4_address($peer_address)
+ validate_integer($port)
+ validate_integer($peer_port)
+ validate_hash($options)
+ validate_re($role, ['primary', 'secondary'])
+
+ include ::dhcp::params
+
+ $_ensure = $ensure? {
+ 'present' => 'file',
+ default => $ensure,
+ }
+
+ file {"${dhcp::params::config_dir}/failover/${name}.conf":
+ ensure => $_ensure,
+ content => template("${module_name}/failover.conf.erb"),
+ group => 'root',
+ mode => '0644',
+ notify => Service['dhcpd'],
+ owner => 'root',
+ }
+
+ concat::fragment {"dhcp.failover.${name}":
+ ensure => $ensure,
+ content => "include \"${dhcp::params::config_dir}/failover/${name}.conf\";\n",
+ target => "${dhcp::params::config_dir}/dhcpd.conf",
+ }
+
+}