fix bind cookboofix bind cookbookk

This commit is contained in:
Jörg Thalheim 2014-01-20 16:10:18 +01:00
parent 7b3eee2f10
commit 5f10663dc6
5 changed files with 15 additions and 9 deletions

View File

@ -19,7 +19,7 @@
"lctp": { "lctp": {
"records": [{ "name": "node1", "type": "A", "value": "172.28.128.101" }] "records": [{ "name": "node1", "type": "A", "value": "172.28.128.101" }]
}, },
"128.28.172.in-addr": { "128.28.172.in-addr.arpa": {
"records": [{ "name": "101", "type": "PTR", "value": "node1" }] "records": [{ "name": "101", "type": "PTR", "value": "node1" }]
} }
}, },

View File

@ -26,10 +26,13 @@ node.bind.zones.each do |name, zone|
action :nothing action :nothing
end end
template "/var/cache/bind/#{name}.zone" do template "/etc/bind/#{name}" do
source "zone.erb" source "zone.erb"
mode "0660"
owner "root"
owner "bind"
notifies :run, "execute[update #{name} zone]" notifies :run, "execute[update #{name} zone]"
variables(zone: zone, zone_name: name) variables(zone: zone, zone_name: name, node: node)
end end
end end

View File

@ -5,6 +5,7 @@ include "/etc/bind/named.conf.default-zones";
<% @node.bind.zones.each do |name, zone| -%> <% @node.bind.zones.each do |name, zone| -%>
zone <%= name %> IN { zone <%= name %> IN {
type master; type master;
file "<%= name %>"; file "/etc/bind/<%= name %>";
}; };
<% end -%> <% end -%>

View File

@ -4,7 +4,10 @@
4H ; retry 4H ; retry
3W ; expire 3W ; expire
1D ) ; minimun 1D ) ; minimun
NS <%= @node.hostname %>
<%= @node.hostname %> A <%= @node.ipaddress %>
<% @zone.records.each do |record| -%> <% @zone.records.each do |record| -%>
<%= record.name %> <%= record.type %> <%= record.value %> <%= record.name %> <%= record.type %> <%= record.value %>
<% end -%> <% end -%>

View File

@ -8,7 +8,7 @@ describe 'bind::default' do
"lctp" => { "lctp" => {
records: [{ name: "node1", type: "A", value: "172.28.128.101" }] records: [{ name: "node1", type: "A", value: "172.28.128.101" }]
}, },
"128.28.172.in-addr" => { "128.28.172.in-addr.arpa" => {
records: [{ name: "101", type: "PTR", value: "node1" }] records: [{ name: "101", type: "PTR", value: "node1" }]
} }
}, },
@ -20,9 +20,8 @@ describe 'bind::default' do
it "should setup named" do it "should setup named" do
chef_run.should render_file("/etc/bind/named.conf").with_content("lctp") chef_run.should render_file("/etc/bind/named.conf").with_content("lctp")
chef_run.should render_file("/etc/bind/named.conf.options").with_content("8.8.8.8") chef_run.should render_file("/etc/bind/named.conf.options").with_content("8.8.8.8")
chef_run.should render_file("/var/cache/bind/lctp.zone").with_content("node1") chef_run.should render_file("/etc/bind/lctp").with_content("node1")
chef_run.should render_file("/var/cache/bind/128.28.172.in-addr.zone").with_content("node1") chef_run.should render_file("/etc/bind/128.28.172.in-addr.arpa").with_content("node1")
chef_run.should install_package("bind9") chef_run.should install_package("bind9")
end end
end end