From 444bb51f0d038c9dc2f5470eaeeaf105b23b952b Mon Sep 17 00:00:00 2001 From: Imran Hossain Shaon Date: Thu, 31 Mar 2016 17:47:10 -0700 Subject: [PATCH] add forward zone file --- recipes/dns_server.rb | 16 ++++++++++++++++ templates/default/namedzone.erb | 10 ++++++++++ 2 files changed, 26 insertions(+) create mode 100644 templates/default/namedzone.erb diff --git a/recipes/dns_server.rb b/recipes/dns_server.rb index 2f9a5fa..455534c 100644 --- a/recipes/dns_server.rb +++ b/recipes/dns_server.rb @@ -9,3 +9,19 @@ source "named.conf.erb" action :create end + +node['bind']['zones']['forward'].each do |zone| + template "/var/named/#{zone['file']}" do + source "namedzone.erb" + action :create + variables zone + end +end + +node['bind']['zones']['reverse'].each do |zone| + template "/var/named/#{zone['file']}" do + source "namedzone.erb" + action :create + variables zone + end +end diff --git a/templates/default/namedzone.erb b/templates/default/namedzone.erb new file mode 100644 index 0000000..835fed4 --- /dev/null +++ b/templates/default/namedzone.erb @@ -0,0 +1,10 @@ +$ORIGIN . +$TTL 86400 ; 1 day +<%= @name %> IN SOA <%= node['fqdn'] %>. root.<%= node['bind']['zones']['name'] %>. ( + 2011071306 ; serial + 3600 ; refresh (1 hour) + 1800 ; retry (30 minutes) + 604800 ; expire (1 week) + 86400 ; minimum (1 day) + ) + NS <%= node['fqdn'] %>.