Revision d527648f
Added by Graeme Gillies about 10 years ago
manifests/pool.pp | ||
---|---|---|
$network,
|
||
$mask,
|
||
$range = false,
|
||
$gateway = false
|
||
$gateway = false,
|
||
$pxeserver = undef,
|
||
) {
|
||
|
||
include dhcp::params
|
spec/defines/pool_spec.rb | ||
---|---|---|
require 'spec_helper'
|
||
|
||
describe 'dhcp::pool' do
|
||
let :title do 'mypool' end
|
||
|
||
let :facts do {
|
||
:osfamily => 'RedHat',
|
||
} end
|
||
|
||
describe 'minimal parameters' do
|
||
let :params do {
|
||
:network => '10.0.0.0',
|
||
:mask => '255.255.255.0',
|
||
} end
|
||
|
||
it {
|
||
content = subject.resource('concat_fragment', 'dhcp.conf+70_mypool.dhcp').send(:parameters)[:content]
|
||
content.split("\n").reject { |c| c =~ /(^\s*#|^$)/ }.should == [
|
||
"subnet 10.0.0.0 netmask 255.255.255.0 {",
|
||
" option subnet-mask 255.255.255.0;",
|
||
"}",
|
||
]
|
||
}
|
||
end
|
||
|
||
describe 'full parameters' do
|
||
let :params do {
|
||
:network => '10.0.0.0',
|
||
:mask => '255.255.255.0',
|
||
:range => '10.0.0.10 - 10.0.0.50',
|
||
:gateway => '10.0.0.1',
|
||
:pxeserver => '10.0.0.2',
|
||
} end
|
||
|
||
it {
|
||
content = subject.resource('concat_fragment', 'dhcp.conf+70_mypool.dhcp').send(:parameters)[:content]
|
||
content.split("\n").reject { |c| c =~ /(^\s*#|^$)/ }.should == [
|
||
"subnet 10.0.0.0 netmask 255.255.255.0 {",
|
||
" pool",
|
||
" {",
|
||
" range 10.0.0.10 - 10.0.0.50;",
|
||
" }",
|
||
" option subnet-mask 255.255.255.0;",
|
||
" option routers 10.0.0.1;",
|
||
" next-server 10.0.0.2;",
|
||
"}",
|
||
]
|
||
}
|
||
end
|
||
end
|
templates/dhcpd.pool.erb | ||
---|---|---|
<% if @gateway -%>
|
||
option routers <%= @gateway %>;
|
||
<% end -%>
|
||
<% if @pxeserver -%>
|
||
next-server <%= @pxeserver %>;
|
||
<% end -%>
|
||
}
|
||
|
Also available in: Unified diff
Add the abiltity to specify different pxeservers per dhcp pool