From f5ba64c51dbbdf69d7b146b91199844a1913eac7 Mon Sep 17 00:00:00 2001 From: Jens Harbott Date: Tue, 28 Nov 2017 09:51:34 +0000 Subject: [PATCH] Add support for deploying multiple DNS servers --- attributes/default.rb | 6 +++--- metadata.rb | 2 +- recipes/common.rb | 6 +++--- templates/default/pools.yaml.erb | 25 +++++++++++++------------ 4 files changed, 20 insertions(+), 19 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 198a3d1..e470b8a 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -41,10 +41,10 @@ default['openstack']['dns']['syslog']['use'] = false default['openstack']['dns']['api']['auth']['version'] = node['openstack']['api']['auth']['version'] # Settings for the default pool -default['openstack']['dns']['pool']['ns_hostname'] = 'ns1.example.org.' -default['openstack']['dns']['pool']['ns_address'] = '127.0.0.1' +default['openstack']['dns']['pool']['ns_hostnames'] = ['ns1.example.org.'] +default['openstack']['dns']['pool']['ns_addresses'] = ['127.0.0.1'] default['openstack']['dns']['pool']['masters'] = ['127.0.0.1'] -default['openstack']['dns']['pool']['bind_host'] = '127.0.0.1' +default['openstack']['dns']['pool']['bind_hosts'] = ['127.0.0.1'] # platform-specific settings default['openstack']['dns']['user'] = 'designate' diff --git a/metadata.rb b/metadata.rb index 3940d54..11c1665 100644 --- a/metadata.rb +++ b/metadata.rb @@ -7,7 +7,7 @@ source_url 'https://github.com/cloudbau/cookbook-openstack-dns' if respond_to?(: license 'Apache 2.0' description 'Installs and configures the Designate Service' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '0.1.0' +version '0.2.0' %w(ubuntu redhat centos).each do |os| supports os diff --git a/recipes/common.rb b/recipes/common.rb index bfca7c2..fbef299 100644 --- a/recipes/common.rb +++ b/recipes/common.rb @@ -139,10 +139,10 @@ template '/etc/designate/pools.yaml' do mode 00644 variables( banner: node['openstack']['dns']['custom_template_banner'], - bind_host: pool_config['bind_host'], + bind_hosts: pool_config['bind_hosts'], masters: pool_config['masters'], - ns_address: pool_config['ns_address'], - ns_hostname: pool_config['ns_hostname'] + ns_addresses: pool_config['ns_addresses'], + ns_hostnames: pool_config['ns_hostnames'] ) end diff --git a/templates/default/pools.yaml.erb b/templates/default/pools.yaml.erb index f45c227..f43807d 100644 --- a/templates/default/pools.yaml.erb +++ b/templates/default/pools.yaml.erb @@ -11,36 +11,37 @@ # This should be a record that is created outside of designate, that # points to the public IP of the controller node. ns_records: - - hostname: <%= @ns_hostname %> +<% @ns_hostnames.each do |ns_hostname| %> + - hostname: <%= ns_hostname %> priority: 1 +<% end %> # List out the nameservers for this pool. These are the actual BIND servers. # We use these to verify changes have propagated to all nameservers. nameservers: - - host: <%= @ns_address %> +<% @ns_addresses.each do |ns_address| %> + - host: <%= ns_address %> port: 53 +<% end %> # List out the targets for this pool. For BIND there will be one # entry for each BIND server, as we have to run rndc command on each server targets: +<% @bind_hosts.each do |bind_host| %> - type: bind9 - description: BIND9 Server 1 + description: BIND9 Server <%= bind_host %> - # List out the designate-mdns servers from which BIND servers should - # request zone transfers (AXFRs) from. - # This should be the IP of the controller node. - # If you have multiple controllers you can add multiple masters - # by running designate-mdns on them, and adding them here. masters: -<% @masters.each do |host| %> +<% @masters.each do |host| %> - host: <%= host %> port: 5354 -<% end %> +<% end %> # BIND Configuration options options: - host: <%= @bind_host %> + host: <%= bind_host %> port: 53 - rndc_host: <%= @bind_host %> + rndc_host: <%= bind_host %> rndc_port: 953 rndc_key_file: /etc/designate/rndc.key +<% end %>