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 # https://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 libxml-treebuilder-perl
35 directory "/srv/dns.openstreetmap.org" do
41 remote_directory "/srv/dns.openstreetmap.org/html" do
53 Dir.glob("/var/lib/dns/json/*.json").each do |kmlfile|
54 zone = File.basename(kmlfile, ".json")
56 template "/srv/dns.openstreetmap.org/html/#{zone}.html" do
57 source "zone.html.erb"
61 variables :zone => zone
67 template "/srv/dns.openstreetmap.org/html/index.html" do
68 source "index.html.erb"
72 variables :zones => zones
75 ssl_certificate "dns.openstreetmap.org" do
76 domains ["dns.openstreetmap.org", "dns.osm.org"]
77 notifies :reload, "service[apache2]"
80 apache_site "dns.openstreetmap.org" do
82 directory "/srv/dns.openstreetmap.org"
83 variables :aliases => ["dns.osm.org"]
86 template "/usr/local/bin/dns-update" do
87 source "dns-update.erb"
91 variables :passwords => passwords
94 execute "dns-update" do
96 command "/usr/local/bin/dns-update"
101 directory "/var/lib/dns" do
105 notifies :run, "execute[dns-update]"
108 cookbook_file "#{node[:dns][:repository]}/hooks/post-receive" do
109 source "post-receive"
115 template "/usr/local/bin/dns-check" do
116 source "dns-check.erb"
120 variables :passwords => passwords
123 template "/etc/cron.d/dns" do