Added support for plain config files and ubuntu/debian os for dhcp::server.
This commit is contained in:
parent
ef8cf14676
commit
195d3245aa
1 changed files with 65 additions and 33 deletions
|
@ -1,16 +1,78 @@
|
|||
|
||||
class dhcp::server {
|
||||
|
||||
include ldap::client::python
|
||||
class dhcp::server::common {
|
||||
|
||||
package { "dhcp":
|
||||
name => $operatingsystem ? {
|
||||
Debian => "dhcp3-server",
|
||||
OpenBSD => "isc-dhcp-server",
|
||||
Ubuntu => "dhcp3-server",
|
||||
default => "dhcp",
|
||||
},
|
||||
ensure => installed,
|
||||
}
|
||||
|
||||
file { "dhcpd.leases":
|
||||
name => $operatingsystem ? {
|
||||
Debian => "/var/lib/dhcp3/dhcpd.leases",
|
||||
OpenBSD => "/var/db/dhcpd.leases",
|
||||
Ubuntu => "/var/lib/dhcp3/dhcpd.leases",
|
||||
default => "/var/lib/dhcpd/dhcpd.leases",
|
||||
},
|
||||
ensure => present,
|
||||
owner => root,
|
||||
group => $operatingsystem ? {
|
||||
OpenBSD => wheel,
|
||||
default => root,
|
||||
},
|
||||
require => Package["dhcp"],
|
||||
before => Service["dhcpd"],
|
||||
}
|
||||
|
||||
service { "dhcpd":
|
||||
name => $operatingsystem ? {
|
||||
Debian => "dhcp3-server",
|
||||
OpenBSD => "isc-dhcpd",
|
||||
Ubuntu => "dhcp3-server",
|
||||
default => "dhcpd",
|
||||
},
|
||||
ensure => running,
|
||||
enable => true,
|
||||
binary => $operatingsystem ? {
|
||||
OpenBSD => "/usr/local/sbin/dhcpd",
|
||||
default => undef,
|
||||
},
|
||||
start => $operatingsystem ? {
|
||||
OpenBSD => "/usr/local/sbin/dhcpd -q",
|
||||
default => undef,
|
||||
},
|
||||
require => Package["dhcp"],
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
class dhcp::server inherits dhcp::server::common {
|
||||
|
||||
file { "/etc/dhcpd.conf":
|
||||
ensure => present,
|
||||
source => [ "puppet:///files/dhcp/dhcpd.conf.${fqdn}",
|
||||
"puppet:///files/dhcp/dhcpd.conf", ],
|
||||
mode => 0644,
|
||||
owner => root,
|
||||
group => $operatingsystem ? {
|
||||
openbsd => wheel,
|
||||
default => root,
|
||||
},
|
||||
notify => Service["dhcpd"],
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
class dhcp::server::ldap inherits dhcp::server::common {
|
||||
|
||||
include ldap::client::python
|
||||
|
||||
file { "/usr/local/sbin/dhcpdump.py":
|
||||
ensure => present,
|
||||
source => "puppet:///dhcp/dhcpdump.py",
|
||||
|
@ -35,36 +97,6 @@ class dhcp::server {
|
|||
require => Package["dhcp"],
|
||||
}
|
||||
|
||||
file { "dhcpd.leases":
|
||||
name => $operatingsystem ? {
|
||||
OpenBSD => "/var/db/dhcpd.leases",
|
||||
default => "/var/lib/dhcpd/dhcpd.leases",
|
||||
},
|
||||
ensure => present,
|
||||
owner => root,
|
||||
group => $operatingsystem ? {
|
||||
OpenBSD => wheel,
|
||||
default => root,
|
||||
},
|
||||
require => Package["dhcp"],
|
||||
before => Service["dhcpd"],
|
||||
}
|
||||
|
||||
service { "dhcpd":
|
||||
ensure => running,
|
||||
enable => true,
|
||||
require => Package["dhcp"],
|
||||
}
|
||||
case $operatingsystem {
|
||||
OpenBSD: {
|
||||
Service["dhcpd"] {
|
||||
name => "isc-dhcpd",
|
||||
binary => "/usr/local/sbin/dhcpd",
|
||||
start => "/usr/local/sbin/dhcpd -q",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exec { "generate-dhcp-conf":
|
||||
path => "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin",
|
||||
command => "dhcpdump.py /etc/dhcpd.conf.in* > /etc/dhcpd.conf",
|
||||
|
|
Loading…
Add table
Reference in a new issue