Revision 142c1fd3
Added by Greg Sutcliffe about 12 years ago
README.md | ||
---|---|---|
|
||
Installs and manages a DHCP server.
|
||
|
||
## Dependencies
|
||
|
||
* Reworked Concat module (https://github.com/GregSutcliffe/pupmod-concat)
|
||
|
||
## Features
|
||
* Multiple subnet support
|
||
* Host reservations
|
manifests/host.pp | ||
---|---|---|
|
||
$dhcp_dir = $dhcp::params::dhcp_dir
|
||
|
||
concat::fragment { "dhcp_host_${name}":
|
||
target => "${dhcp_dir}/dhcpd.hosts",
|
||
content => template("dhcp/dhcpd.host.erb"),
|
||
order => 10,
|
||
concat::fragment { "dhcp.hosts+10_${name}.hosts"
|
||
content => template("dhcp/dhcpd.host.erb"),
|
||
}
|
||
}
|
||
|
||
}
|
manifests/init.pp | ||
---|---|---|
}
|
||
}
|
||
|
||
# file { "${dhcp_dir}/dhcpd.conf":
|
||
# owner => root,
|
||
# group => 0,
|
||
# mode => 644,
|
||
# require => Package[$packagename],
|
||
# }
|
||
concat_build { 'dhcp.conf':
|
||
order => ['*.dhcp'],
|
||
target => "${dhcp_dir}/dhcpd.conf",
|
||
require => Package[$packagename],
|
||
notify => [Service["$servicename"],File["${dhcp_dir}/dhcpd.conf"]],
|
||
}
|
||
file { "${dhcp_dir}/dhcpd.conf":
|
||
owner => 'root',
|
||
group => 'root',
|
||
mode => 0644,
|
||
require => Package[$packagename],
|
||
}
|
||
|
||
include concat::setup
|
||
concat_fragment { "dhcp.conf+01_main.dhcp":
|
||
content => template("dhcp/dhcpd.conf.erb"),
|
||
}
|
||
|
||
concat { "${dhcp_dir}/dhcpd.conf":
|
||
|
||
concat_build { 'dhcp.hosts':
|
||
order => ['*.hosts'],
|
||
target => "${dhcp_dir}/dhcpd.hosts",
|
||
require => Package[$packagename],
|
||
notify => [Service["$servicename"],File["${dhcp_dir}/dhcpd.hosts"]],
|
||
}
|
||
concat::fragment { 'dhcp-conf-main':
|
||
target => "${dhcp_dir}/dhcpd.conf",
|
||
content => template("dhcp/dhcpd.conf.erb"),
|
||
order => 01,
|
||
owner => root,
|
||
group => 0,
|
||
mode => 644,
|
||
require => Package[$packagename],
|
||
file { "${dhcp_dir}/dhcpd.hosts":
|
||
owner => 'root',
|
||
group => 'root',
|
||
mode => 0644,
|
||
require => Package[$packagename],
|
||
}
|
||
|
||
concat { "${dhcp_dir}/dhcpd.hosts": }
|
||
concat::fragment { 'dhcp-hosts-header':
|
||
target => "${dhcp_dir}/dhcpd.hosts",
|
||
concat_fragment { 'dhcp.hosts+01_main.hosts':
|
||
content => "# static DHCP hosts\n",
|
||
order => 01,
|
||
}
|
||
|
||
service {
|
||
... | ... | |
enable => "true",
|
||
ensure => "running",
|
||
hasstatus => true,
|
||
subscribe => [Concat["${dhcp_dir}/dhcpd.hosts"], File["${dhcp_dir}/dhcpd.conf"]],
|
||
subscribe => [File["${dhcp_dir}/dhcpd.hosts"], File["${dhcp_dir}/dhcpd.conf"]],
|
||
require => Package["$packagename"];
|
||
}
|
||
|
||
if $dhcp_monitor == true { include dhcp::monitor }
|
||
|
||
}
|
manifests/monitor.pp | ||
---|---|---|
# ------------
|
||
# Monitoring
|
||
# ------------
|
||
class dhcp::monitor {
|
||
include munin::dhcp
|
||
}
|
manifests/pool.pp | ||
---|---|---|
|
||
$dhcp_dir = $dhcp::params::dhcp_dir
|
||
|
||
concat::fragment { "dhcp_pool_${name}":
|
||
target => "${dhcp_dir}/dhcpd.conf",
|
||
content => template("dhcp/dhcpd.pool.erb"),
|
||
order => 70,
|
||
concat_fragment { "dhcp.conf+70_${name}.dhcp":
|
||
content => template("dhcp/dhcpd.pool.erb"),
|
||
}
|
||
|
||
}
|
||
|
Also available in: Unified diff
Rework to use my rewritten concat module