diff --git a/dhcp/manifests/init.pp b/dhcp/manifests/init.pp index 9323270..1e65604 100644 --- a/dhcp/manifests/init.pp +++ b/dhcp/manifests/init.pp @@ -1,4 +1,6 @@ +# Install common parts of DHCP server +# class dhcp::server::common { case $::operatingsystem { @@ -83,16 +85,45 @@ class dhcp::server::common { OpenBSD => "/usr/local/sbin/dhcpd", default => undef, }, - start => $operatingsystem ? { - OpenBSD => "/usr/local/sbin/dhcpd -q", + start => $::operatingsystem ? { + OpenBSD => $dhcp_server_interface ? { + "" => "/usr/local/sbin/dhcpd -q", + default => "/usr/local/sbin/dhcpd -q ${dhcp_server_interface}", + }, default => undef, }, require => Package["dhcp"], } + if $dhcp_server_interface { + case $::operatingsystem { + "fedora","centos": { + file { "/etc/sysconfig/dhcpd": + ensure => present, + content => "DHCPDARGS=${dhcp_server_interface}\n", + mode => "0644", + owner => "root", + group => "root", + notify => Service["dhcpd"], + } + } + "openbsd": {} + default: { + fail("Variable \${dhcp_server_interface} not supported in ${::operatinsystem}") + } + } + } + } +# Install DHCP server with static config. +# +# === Global variables +# +# $dhcp_server_interface: +# Interface that DHCP server should listen. Defaults to all. +# class dhcp::server inherits dhcp::server::common { file { "dhcpd.conf": @@ -112,6 +143,13 @@ class dhcp::server inherits dhcp::server::common { } +# Install DHCP server and generate config from LDAP. +# +# === Global variables +# +# $dhcp_server_interface: +# Interface that DHCP server should listen. Defaults to all. +# class dhcp::server::ldap inherits dhcp::server::common { include python