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
39 # remote_file "/usr/local/bin/dnscontrol" do
41 # source "https://github.com/StackExchange/dnscontrol/releases/download/v2.10.0/dnscontrol-Linux"
47 directory "/srv/dns.openstreetmap.org" do
53 remote_directory "/srv/dns.openstreetmap.org/html" do
65 Dir.glob("/var/lib/dns/json/*.json").each do |kmlfile|
66 zone = File.basename(kmlfile, ".json")
68 template "/srv/dns.openstreetmap.org/html/#{zone}.html" do
69 source "zone.html.erb"
73 variables :zone => zone
79 template "/srv/dns.openstreetmap.org/html/index.html" do
80 source "index.html.erb"
84 variables :zones => zones
87 ssl_certificate "dns.openstreetmap.org" do
88 domains ["dns.openstreetmap.org", "dns.osm.org"]
89 notifies :reload, "service[apache2]"
92 apache_site "dns.openstreetmap.org" do
94 directory "/srv/dns.openstreetmap.org"
95 variables :aliases => ["dns.osm.org"]
98 template "/usr/local/bin/dns-update" do
99 source "dns-update.erb"
103 variables :passwords => passwords, :geoservers => geoservers
106 cookbook_file "/usr/local/bin/dns-update-sshfp" do
107 source "dns-update-sshfp"
113 execute "dns-update" do
115 command "/usr/local/bin/dns-update"
120 directory "/var/lib/dns" do
124 notifies :run, "execute[dns-update]"
127 template "/var/lib/dns/creds.json" do
128 source "creds.json.erb"
132 variables :passwords => passwords
135 execute "dns-update-sshfp" do
137 command "/usr/local/bin/dns-update-sshfp"
140 subscribes :run, "template[/etc/ssh/ssh_known_hosts]"
143 cookbook_file "#{node[:dns][:repository]}/hooks/post-receive" do
144 source "post-receive"
150 template "/usr/local/bin/dns-check" do
151 source "dns-check.erb"
155 variables :passwords => passwords, :geoservers => geoservers
158 template "/etc/cron.d/dns" do