Skip to content

Commit

Permalink
Merge pull request crowbar#45 from rhafer/release/pebbles/master
Browse files Browse the repository at this point in the history
crowbar#45

Merged by devtool for VictorLowther
  • Loading branch information
VictorLowther committed May 12, 2013
2 parents 1784d4f + 33cd5ec commit 305f59b
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 13 deletions.
2 changes: 1 addition & 1 deletion chef/cookbooks/bind9/attributes/default.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

default[:dns][:forwarders] = [ ]

default[:dns][:allow_transfer] = [ ]
26 changes: 17 additions & 9 deletions chef/cookbooks/bind9/recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@

package "bind9" do
case node[:platform]
when "centos","redhat"
when "centos","redhat", "suse"
package_name "bind"
end
action :install
end
package "bind9utils" do
case node[:platform]
when "centos","redhat"
when "centos","redhat", "suse"
package_name "bind-utils"
end
action :install
Expand Down Expand Up @@ -59,7 +59,7 @@ def make_zone(zone)
owner "root"
case node[:platform]
when "ubuntu","debian" then group "bind"
when "centos","redhat" then group "named"
when "centos","redhat","suse" then group "named"
end
notifies :reload, "service[bind9]"
variables(:zone => zone)
Expand Down Expand Up @@ -103,7 +103,7 @@ def make_zone(zone)
owner "root"
case node[:platform]
when "ubuntu","debian" then group "bind"
when "centos","redhat" then group "named"
when "centos","redhat","suse" then group "named"
end
notifies :reload, "service[bind9]"
variables(:zones => zonefile_entries)
Expand Down Expand Up @@ -170,11 +170,18 @@ def make_zone(zone)
owner "root"
variables :options => { "OPTIONS" => "-c /etc/bind/named.conf" }
end
when "suse"
template "/etc/sysconfig/named" do
source "suse-sysconfig-named.erb"
mode 0644
owner "root"
variables :options => { "NAMED_ARGS" => "-c /etc/bind/named.conf" }
end
end

service "bind9" do
case node[:platform]
when "centos","redhat"
when "centos","redhat","suse"
service_name "named"
end
supports :restart => true, :status => true, :reload => true
Expand All @@ -190,7 +197,7 @@ def make_zone(zone)
source "#{file}.erb"
case node[:platform]
when "ubuntu","debian" then group "bind"
when "centos","redhat" then group "named"
when "centos","redhat","suse" then group "named"
end
mode 0644
owner "root"
Expand Down Expand Up @@ -219,7 +226,7 @@ def make_zone(zone)
owner "root"
case node[:platform]
when "ubuntu","debian" then group "bind"
when "centos","redhat" then group "named"
when "centos","redhat","suse" then group "named"
end
variables(:zonefiles => node[:dns][:zone_files])
notifies :reload, "service[bind9]"
Expand All @@ -232,9 +239,10 @@ def make_zone(zone)
owner "root"
case node[:platform]
when "ubuntu","debian" then group "bind"
when "centos","redhat" then group "named"
when "centos","redhat","suse" then group "named"
end
variables(:forwarders => node[:dns][:forwarders])
variables(:forwarders => node[:dns][:forwarders],
:allow_transfer => node[:dns][:allow_transfer])
notifies :restart, "service[bind9]", :immediately
end

Expand Down
14 changes: 11 additions & 3 deletions chef/cookbooks/bind9/templates/default/named.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,21 @@ options {
// Uncomment the following block, and insert the addresses replacing
// the all-0's placeholder.

forwarders {
<% if [email protected]? and [email protected]? -%>
forwarders {
<% @forwarders.each do |i| -%>
<%= i %>;
<%= i %>;
<% end -%>
<% end -%>
};
<% end -%>

<% if !@allow_transfer.nil? and !@allow_transfer.empty? -%>
allow-transfer {
<% @allow_transfer.each do |at| -%>
<%= at %>;
<% end -%>
};
<% end -%>

auth-nxdomain no; # conform to RFC1035
listen-on-v6 { any; };
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Maintaned by Crowbar.
# Do not edit.
<% @options.each { |k,v| -%>
<%= "#{k}=\"#{v}\"" %>
<% } -%>
NAMED_RUN_CHROOTED="no"
3 changes: 3 additions & 0 deletions chef/cookbooks/resolver/recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@
dns_list = []
if !nodes.nil? and !nodes.empty?
dns_list = nodes.map { |x| Chef::Recipe::Barclamp::Inventory.get_network_by_type(x, "admin").address }
elsif !node["crowbar"].nil? and node["crowbar"]["admin_node"] and !node[:dns][:forwarders].nil?
dns_list << node[:dns][:forwarders]
end

dns_list << node[:dns][:nameservers]

template "/etc/resolv.conf" do
Expand Down
2 changes: 2 additions & 0 deletions chef/data_bags/crowbar/bc-template-dns.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"domain": "pod.your.cloud.org",
"contact": "[email protected]",
"forwarders": [ ],
"allow_transfer": [ ],
"nameservers": [ ],
"static": { }
}
},
Expand Down
10 changes: 10 additions & 0 deletions chef/data_bags/crowbar/bc-template-dns.schema
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@
"required": true,
"sequence": [ { "type": "str", "name": "IpAddress" } ]
},
"nameservers": {
"type": "seq",
"required": false,
"sequence": [ { "type": "str", "name": "IpAddress" } ]
},
"allow_transfer": {
"type": "seq",
"required": false,
"sequence": [ { "type": "str" } ]
},
"static": {
"type": "map",
"required": true,
Expand Down

0 comments on commit 305f59b

Please sign in to comment.