5 # Copyright 2011, OpenStreetMap Foundation
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
21 include_recipe "apache"
23 passwords = data_bag_item("dns", "passwords")
28 package "libxml-treebuilder-perl"
29 package "libxml-writer-perl"
30 package "libyaml-perl"
32 package "libjson-xs-perl"
34 directory "/srv/dns.openstreetmap.org" do
40 remote_directory "/srv/dns.openstreetmap.org/html" do
52 Dir.glob("/var/lib/dns/json/*.json").each do |kmlfile|
53 zone = File.basename(kmlfile, ".json")
55 template "/srv/dns.openstreetmap.org/html/#{zone}.html" do
56 source "zone.html.erb"
60 variables :zone => zone
66 template "/srv/dns.openstreetmap.org/html/index.html" do
67 source "index.html.erb"
71 variables :zones => zones
74 apache_site "dns.openstreetmap.org" do
76 directory "/srv/dns.openstreetmap.org"
79 template "/usr/local/bin/dns-update" do
80 source "dns-update.erb"
84 variables :passwords => passwords
87 execute "dns-update" do
89 command "/usr/local/bin/dns-update"
94 directory "/var/lib/dns" do
98 notifies :run, "execute[dns-update]"
101 cookbook_file "#{node[:dns][:repository]}/hooks/post-receive" do
102 source "post-receive"
108 template "/usr/local/bin/dns-check" do
109 source "dns-check.erb"
113 variables :passwords => passwords
116 template "/etc/cron.d/dns" do