Added support for setting interface that DHCP server listens to.

This commit is contained in:
Timo Mkinen 2012-07-02 12:33:58 +03:00
parent 52431fa155
commit 9dda4f89be

View file

@ -1,4 +1,6 @@
# Install common parts of DHCP server
#
class dhcp::server::common { class dhcp::server::common {
case $::operatingsystem { case $::operatingsystem {
@ -83,16 +85,45 @@ class dhcp::server::common {
OpenBSD => "/usr/local/sbin/dhcpd", OpenBSD => "/usr/local/sbin/dhcpd",
default => undef, default => undef,
}, },
start => $operatingsystem ? { start => $::operatingsystem ? {
OpenBSD => "/usr/local/sbin/dhcpd -q", OpenBSD => $dhcp_server_interface ? {
"" => "/usr/local/sbin/dhcpd -q",
default => "/usr/local/sbin/dhcpd -q ${dhcp_server_interface}",
},
default => undef, default => undef,
}, },
require => Package["dhcp"], 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 { class dhcp::server inherits dhcp::server::common {
file { "dhcpd.conf": 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 { class dhcp::server::ldap inherits dhcp::server::common {
include python include python