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 geoservers = search(:node, "roles:geodns").collect(&:name).sort
25 passwords = data_bag_item("dns", "passwords")
32 libxml-treebuilder-perl
41 remote_file "/usr/local/bin/dnscontrol" do
43 source "https://github.com/StackExchange/dnscontrol/releases/download/v3.0.0/dnscontrol-Linux"
49 directory "/srv/dns.openstreetmap.org" do
55 remote_directory "/srv/dns.openstreetmap.org/html" do
67 Dir.glob("/var/lib/dns/json/*.json").each do |kmlfile|
68 zone = File.basename(kmlfile, ".json")
70 template "/srv/dns.openstreetmap.org/html/#{zone}.html" do
71 source "zone.html.erb"
75 variables :zone => zone
81 template "/srv/dns.openstreetmap.org/html/index.html" do
82 source "index.html.erb"
86 variables :zones => zones
89 ssl_certificate "dns.openstreetmap.org" do
90 domains ["dns.openstreetmap.org", "dns.osm.org"]
91 notifies :reload, "service[apache2]"
94 apache_site "dns.openstreetmap.org" do
96 directory "/srv/dns.openstreetmap.org"
97 variables :aliases => ["dns.osm.org"]
100 template "/usr/local/bin/dns-update" do
101 source "dns-update.erb"
105 variables :passwords => passwords, :geoservers => geoservers
108 execute "dns-update" do
110 command "/usr/local/bin/dns-update"
115 directory "/var/lib/dns" do
119 notifies :run, "execute[dns-update]"
122 template "/var/lib/dns/creds.json" do
123 source "creds.json.erb"
127 variables :passwords => passwords
130 cookbook_file "#{node[:dns][:repository]}/hooks/post-receive" do
131 source "post-receive"
137 template "/usr/local/bin/dns-check" do
138 source "dns-check.erb"
142 variables :passwords => passwords, :geoservers => geoservers
145 template "/etc/cron.d/dns" do