Skip to content

Commit

Permalink
Merge pull request #112 from jearls/issues/101-control-named.conf
Browse files Browse the repository at this point in the history
issue 101: take control of named.conf.
  • Loading branch information
solarkennedy committed May 9, 2015
2 parents 186032c + 5054a53 commit fdf7c1e
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions manifests/server/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
owner => $owner,
group => $group,
mode => '0644',
content => template("${module_name}/named.conf.erb"),
require => [
File[$cfg_dir],
Class['dns::server::install']
Expand Down
6 changes: 6 additions & 0 deletions manifests/server/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
$cfg_dir = '/etc/bind'
$cfg_file = '/etc/bind/named.conf'
$data_dir = '/etc/bind/zones'
$root_hint = "${cfg_dir}/db.root"
$rfc1912_zones_cfg = "${cfg_dir}/named.conf.default-zones"
$rndc_key_file = "${cfg_dir}/ns-example-com_rndc-key"
$group = 'bind'
$owner = 'bind'
$package = 'bind9'
Expand All @@ -16,6 +19,9 @@
$cfg_dir = '/etc/named'
$cfg_file = '/etc/named.conf'
$data_dir = '/var/named'
$root_hint = "${data_dir}/named.ca"
$rfc1912_zones_cfg = '/etc/named.rfc1912.zones'
$rndc_key_file = '/etc/named.root.key'
$group = 'named'
$owner = 'named'
$package = 'bind'
Expand Down
10 changes: 10 additions & 0 deletions spec/classes/dns__server__config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,17 @@
}
end
it { should contain_file('/etc/bind/').with_owner('bind') }
it { should contain_file('/etc/bind/named.conf').with_content(/^include "\/etc\/bind\/named.conf.options";$/) }
end

context "on a RedHat OS" do
let :facts do
{
:osfamily => 'RedHat'
}
end
it { should contain_file('/etc/named.conf').with_owner('named') }
it { should contain_file('/etc/named.conf').with_content(/^include "\/etc\/named\/named.conf.options";$/) }
end
end

18 changes: 18 additions & 0 deletions templates/named.conf.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
; File managed by puppet.
;

include "<%= @cfg_dir %>/named.conf.options";
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
zone "." IN {
type hint;
file "<%= @root_hint %>";
};
include "<%= @rfc1912_zones_cfg %>";
include "<%= @rndc_key_file %>";
include "<%= @cfg_dir %>/named.conf.local";

0 comments on commit fdf7c1e

Please sign in to comment.