Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue 101: take control of named.conf. #112

Merged
merged 2 commits into from May 9, 2015
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 %>";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use @root_hint for puppet 4 compat

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, I missed that one, sorry! fix committed.

};
include "<%= @rfc1912_zones_cfg %>";
include "<%= @rndc_key_file %>";
include "<%= @cfg_dir %>/named.conf.local";