Skip to content

Commit

Permalink
added ipv6 nameservers param
Browse files Browse the repository at this point in the history
  • Loading branch information
alelindq committed Oct 20, 2016
1 parent 74cea55 commit 07f5ea9
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
class dhcp (
$dnsdomain = undef,
$nameservers = [ '8.8.8.8', '8.8.4.4' ],
$nameservers_ipv6 = [],
$ntpservers = [],
$dnssearchdomains = [],
$dhcp_conf_header = 'INTERNAL_TEMPLATE',
Expand Down Expand Up @@ -57,6 +58,7 @@
validate_array($dnssearchdomains)

validate_array($nameservers)
validate_array($nameservers_ipv6)
validate_array($ntpservers)
validate_bool($authoritative)

Expand Down
3 changes: 3 additions & 0 deletions spec/classes/dhcp_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
{
'dnsdomain' => ['sampledomain.com', '1.1.1.in-addr.arpa'],
'nameservers' => ['1.1.1.1'],
'nameservers_ipv6' => ['1:5ee:bad::c0de'],
'dhcp_conf_header' => 'INTERNAL_TEMPLATE',
'dhcp_conf_ddns' => 'INTERNAL_TEMPLATE',
'dhcp_conf_pxe' => 'INTERNAL_TEMPLATE',
Expand Down Expand Up @@ -185,10 +186,12 @@
'include "/etc/rndc.key";',
"zone #{params['dnsdomain'].first}. {",
" primary #{params['nameservers'].first};",
" primary6 #{params['nameservers_ipv6'].first};",
' key rndc.key;',
'}',
"zone #{params['dnsdomain'].last}. {",
" primary #{params['nameservers'].first};",
" primary6 #{params['nameservers_ipv6'].first};",
' key rndc.key;',
'}'
]
Expand Down
5 changes: 5 additions & 0 deletions templates/dhcpd.conf-header.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ log-facility <%= @logfacility %>;
# Options
# ----------
option domain-name "<%= @dnsdomain_real.first %>";
<% if @nameservers && !@nameservers.empty? -%>
option domain-name-servers <%= @nameservers.join(', ') %>;
<% end -%>
<% if @nameservers_ipv6 && !@nameservers_ipv6.empty? -%>
option dhcp6.name-servers <%= @nameservers_ipv6.join(', ') %>;
<% end -%>
<% if @dnssearchdomains && !@dnssearchdomains.empty? -%>
option domain-search "<%= @dnssearchdomains.join('", "') %>";
<% end -%>
Expand Down
5 changes: 5 additions & 0 deletions templates/dhcpd.conf.ddns.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ use-host-decl-names on;
include "<%= @dnsupdatekey %>";
<% @dnsdomain_real.each do |dom| -%>
zone <%= dom %>. {
<% if @nameservers && !@nameservers.empty? -%>
primary <%= @nameservers.first %>;
<% end -%>
<% if @nameservers_ipv6 && !@nameservers_ipv6.empty? -%>
primary6 <%= @nameservers_ipv6.first %>;
<% end -%>
key <%= @_dnskeyname %>;
}
<% end -%>
Expand Down

0 comments on commit 07f5ea9

Please sign in to comment.