Skip to content
This repository has been archived by the owner on Sep 12, 2020. It is now read-only.

Commit

Permalink
start knot2 compatibility work. refs #3
Browse files Browse the repository at this point in the history
  • Loading branch information
tobru committed Nov 23, 2015
1 parent 0ee8082 commit 9bd8a97
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 78 deletions.
1 change: 1 addition & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
# Log statement hash. See https://www.knot-dns.cz/documentation/html/reference.html#log-statement
#
# [*interfaces*]
# This setting is here to keep the backwards compatibility. Since version 2.0 this has been part of system variable.
# Default:
# $interfaces = {
# all_ipv4 => {
Expand Down
4 changes: 2 additions & 2 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@
'port' => 53,
},
'all_ipv6' => {
'address' => '[::]',
'address' => '::',
'port' => 53,
}
}
$control = {
'listen-on' => 'knot.sock'
'listen' => 'knot.sock'
}
$zone_storage = '/var/lib/knot'
$dnssec_keydir = '/etc/knot/dnssec_keys.d'
Expand Down
82 changes: 18 additions & 64 deletions templates/knot.conf.erb
Original file line number Diff line number Diff line change
@@ -1,74 +1,28 @@
# THIS CONFIGURATION IS MANAGED BY PUPPET
# see man 5 knot.conf for all available configuration options
system {
user <%= @service_user %>.<%= @service_group %>;
<%- @system.each do |k,v| -%>
<%= k %> <%= v %>;
<%- end -%>
}
<%- require 'yaml' -%>

<%- if @keys -%>
keys {
<%- @keys.each do |k,v| -%>
<%= k %> <%= v['algorithm'] %> "<%= v['key'] %>";
<%- end -%>
}
<%- end -%>
server:
user: <%= @service_user %>:<%= @service_group %>
<%- @system.each do |k,v| -%>
<%= k %>: <%= v %>
<%- end -%>
<%- @interfaces.each do |k,v| -%>
listen: <%= v['address'] %>@<%= v['port'] %>
<%- end -%>

interfaces {
<%- @interfaces.each do |k,v| -%>
<%= k -%> {
<%- v.each do |y,z| -%>
<%= y %> <%= z %>;
<%- end -%>
}
<%- end -%>
}

<%- if @remotes -%>
remotes {
<%- @remotes.each do |k,v| -%>
<%= k -%> {
<%- v.each do |y,z| -%>
<%= y %> <%= z %>;
<%- end -%>
}
<%- end -%>
}
<%- end -%>
log:
<%- @log.each do |k,v| -%>
- target: <%= k -%>

<%- if @groups -%>
groups {
<%- @groups.each do |k,v| -%>
<%= k %> { <%= v %> }
<%- end -%>
}
<%- v.each do |y,z| -%>
<%= y %>: <%= z %>
<%- end -%>
<%- end -%>

control {
control:
<%- @control.each do |k,v| -%>
<%= k %> <%= v %>;
<%- end -%>
}

zones {
storage "<%= @zone_storage %>";
<%- if @dnssec_enable -%>
dnssec-enable on;
dnssec-keydir "<%= @dnssec_keydir %>";
<%= k %>: <%= v %>
<%- end -%>
<%- if @zone_options then @zone_options.each do |k,v| -%>
<%= k %> <%= v %>;
<%- end end -%>
include "<%= @zones_file %>";
}

log {
<%- @log.each do |k,v| -%>
<%= k -%> {
<%- v.each do |y,z| -%>
<%= y %> <%= z %>;
<%- end -%>
}
<%- end -%>
}
include: "<%= @zones_config_file %>"
24 changes: 13 additions & 11 deletions templates/zones.conf.erb
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# THIS CONFIGURATION IS MANAGED BY PUPPET
# see man 5 knot.conf for all available configuration options
<%- @zones.each do |k,v| -%>
<%= k -%> {
file "<%= k.gsub(/\//, "_") -%>.zone";
<%- if (@zone_defaults && v && v.length > 0) then _v = @zone_defaults.merge(v) -%>
<%- elsif (v && v.length > 0) then _v = v -%>
<%- elsif (@zone_defaults && @zone_defaults.length > 0) then _v = @zone_defaults -%>
<%- end -%>
<%- if (_v && _v.length > 0) then _v.each do |y,z| -%>
<%= y %> <%= z %>;
<%- end end -%>
}

zone:
<%- @zones.each do |k,v| -%>
- domain: <%= k -%>
file: "<%= k -%>.zone"
<%- if (@zone_defaults && v && v.length > 0) then _v = @zone_defaults.merge(v) -%>
<%- elsif (v && v.length > 0) then _v = v -%>
<%- elsif (@zone_defaults && @zone_defaults.length > 0) then _v = @zone_defaults -%>
<%- end -%>
<%- if (_v && _v.length > 0) then _v.each do |y,z| -%>
<%= y %>: <%= z %>
<%- end end -%>
<%- end -%>

2 changes: 1 addition & 1 deletion tests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
class { 'knot':
zones => { 'myzone.net' => '',
'myotherzone.com' => {
'xfr-out' => 'server1' },
'notify' => 'server1' },
},
}

0 comments on commit 9bd8a97

Please sign in to comment.