forked from voxpupuli/puppet-dhcp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request voxpupuli#121 from aquister/pool6
support for IPv6 pool
- Loading branch information
Showing
3 changed files
with
118 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# == Define: dhcp::pool6 | ||
# | ||
define dhcp::pool6 ( | ||
$network, | ||
$prefix, | ||
$range = '', | ||
$range_temp = '', | ||
$failover = '', | ||
$options = '', | ||
$parameters = '', | ||
$nameservers = undef, | ||
$nameservers_ipv6 = undef, | ||
$pxeserver = undef, | ||
$mtu = undef, | ||
$domain_name = '', | ||
$ignore_unknown = undef, | ||
) { | ||
if $mtu { | ||
validate_integer($mtu) | ||
} | ||
|
||
include ::dhcp::params | ||
|
||
$dhcp_dir = $dhcp::params::dhcp_dir | ||
|
||
concat::fragment { "dhcp_pool_${name}": | ||
target => "${dhcp_dir}/dhcpd.pools", | ||
content => template('dhcp/dhcpd.pool6.erb'), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
require 'spec_helper' | ||
|
||
describe 'dhcp::pool6', type: :define do | ||
let :title do | ||
'test_pool6' | ||
end | ||
let(:facts) do | ||
{ | ||
concat_basedir: '/dne', | ||
osfamily: 'RedHat' | ||
} | ||
end | ||
let :params do | ||
{ | ||
'network' => '2001:db8::', | ||
'prefix' => '64', | ||
'range' => '2001:db8::100 2001:db8::110' | ||
} | ||
end | ||
|
||
it { should contain_concat__fragment("dhcp_pool_#{title}") } | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
################################# | ||
# <%= @name %> <%= @network %>/<%= @prefix %> | ||
################################# | ||
subnet6 <%= @network %>/<%= @prefix %> { | ||
<% if @range != '' or @failover != '' -%> | ||
pool6 | ||
{ | ||
<% if @failover != '' -%> | ||
failover peer "<%= @failover %>"; | ||
<% end -%> | ||
<% if @ignore_unknown == true -%> | ||
ignore unknown-clients ; | ||
<% end -%> | ||
<% if @range and @range.is_a? Array -%> | ||
<% @range.each do |r| -%> | ||
range6 <%= r %>; | ||
<% end -%> | ||
<% elsif @range != '' -%> | ||
range6 <%= @range %>; | ||
<% end -%> | ||
<% if @range_temp and @range_temp.is_a? Array -%> | ||
<% @range_temp.each do |r| -%> | ||
range6 <%= r %> temporary; | ||
<% end -%> | ||
<% elsif @range_temp != '' -%> | ||
range6 <%= @range_temp %> temporary; | ||
<% end -%> | ||
|
||
} | ||
<% end -%> | ||
|
||
<% if @domain_name and !@domain_name.empty? -%> | ||
option domain-name "<%= @domain_name %>"; | ||
<% end -%> | ||
<% if @options.is_a? Array -%> | ||
<% @options.each do |opt| -%> | ||
option <%= opt %>; | ||
<% end -%> | ||
<% elsif @options != '' -%> | ||
option <%= @options %>; | ||
<% end -%> | ||
<% if @parameters.is_a? Array -%> | ||
<% @parameters.each do |param| -%> | ||
<%= param %>; | ||
<% end -%> | ||
<% elsif @parameters != '' -%> | ||
<%= @parameters %>; | ||
<% end -%> | ||
<% if @nameservers and @nameservers.is_a? Array -%> | ||
option domain-name-servers <%= @nameservers.join(', ') %>; | ||
<% elsif @nameservers -%> | ||
option domain-name-servers <%= @nameservers %>; | ||
<% end -%> | ||
<% if @nameservers_ipv6 and @nameservers_ipv6.is_a? Array -%> | ||
option dhcp6.name-servers <%= @nameservers_ipv6.join(', ') %>; | ||
<% elsif @nameservers_ipv6 -%> | ||
option dhcp6.name-servers <%= @nameservers_ipv6 %>; | ||
<% end -%> | ||
<% if @pxeserver -%> | ||
next-server <%= @pxeserver %>; | ||
<% end -%> | ||
<% if @mtu -%> | ||
option interface-mtu <%= @mtu %>; | ||
<% end -%> | ||
} | ||
|