diff --git a/chef/cookbooks/bind9/attributes/default.rb b/chef/cookbooks/bind9/attributes/default.rb index 5aaaed4..1ed9671 100644 --- a/chef/cookbooks/bind9/attributes/default.rb +++ b/chef/cookbooks/bind9/attributes/default.rb @@ -1,3 +1,3 @@ default[:dns][:forwarders] = [ ] - +default[:dns][:allow_transfer] = [ ] diff --git a/chef/cookbooks/bind9/recipes/default.rb b/chef/cookbooks/bind9/recipes/default.rb index 2af597f..815655d 100644 --- a/chef/cookbooks/bind9/recipes/default.rb +++ b/chef/cookbooks/bind9/recipes/default.rb @@ -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 @@ -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) @@ -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) @@ -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 @@ -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" @@ -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]" @@ -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 diff --git a/chef/cookbooks/bind9/templates/default/named.conf.erb b/chef/cookbooks/bind9/templates/default/named.conf.erb index da61324..9242ff9 100644 --- a/chef/cookbooks/bind9/templates/default/named.conf.erb +++ b/chef/cookbooks/bind9/templates/default/named.conf.erb @@ -13,13 +13,21 @@ options { // Uncomment the following block, and insert the addresses replacing // the all-0's placeholder. - forwarders { <% if !@forwarders.nil? and !@forwarders.empty? -%> + 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; }; diff --git a/chef/cookbooks/bind9/templates/default/suse-sysconfig-named.erb b/chef/cookbooks/bind9/templates/default/suse-sysconfig-named.erb new file mode 100644 index 0000000..6aae97f --- /dev/null +++ b/chef/cookbooks/bind9/templates/default/suse-sysconfig-named.erb @@ -0,0 +1,6 @@ +# Maintaned by Crowbar. +# Do not edit. +<% @options.each { |k,v| -%> +<%= "#{k}=\"#{v}\"" %> +<% } -%> +NAMED_RUN_CHROOTED="no" diff --git a/chef/cookbooks/resolver/recipes/default.rb b/chef/cookbooks/resolver/recipes/default.rb index 1021646..3b26248 100644 --- a/chef/cookbooks/resolver/recipes/default.rb +++ b/chef/cookbooks/resolver/recipes/default.rb @@ -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 diff --git a/chef/data_bags/crowbar/bc-template-dns.json b/chef/data_bags/crowbar/bc-template-dns.json index 5a71bb3..dde4b91 100644 --- a/chef/data_bags/crowbar/bc-template-dns.json +++ b/chef/data_bags/crowbar/bc-template-dns.json @@ -6,6 +6,8 @@ "domain": "pod.your.cloud.org", "contact": "support@pod.your.cloud.org", "forwarders": [ ], + "allow_transfer": [ ], + "nameservers": [ ], "static": { } } }, diff --git a/chef/data_bags/crowbar/bc-template-dns.schema b/chef/data_bags/crowbar/bc-template-dns.schema index 7a9074d..8c22db3 100644 --- a/chef/data_bags/crowbar/bc-template-dns.schema +++ b/chef/data_bags/crowbar/bc-template-dns.schema @@ -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,