From b53cbecada759e3169a483989fc50d9e2a5c25c0 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Fri, 7 Feb 2020 15:39:00 +0000 Subject: [PATCH] Install dnscontrol and API credentials on DNS management server --- cookbooks/dns/recipes/default.rb | 16 ++++++++++++++++ cookbooks/dns/templates/default/creds.json.erb | 11 +++++++++++ 2 files changed, 27 insertions(+) create mode 100644 cookbooks/dns/templates/default/creds.json.erb diff --git a/cookbooks/dns/recipes/default.rb b/cookbooks/dns/recipes/default.rb index 1896e99b8..ac404488b 100644 --- a/cookbooks/dns/recipes/default.rb +++ b/cookbooks/dns/recipes/default.rb @@ -36,6 +36,14 @@ package %w[ libjson-xs-perl ] +remote_file "/usr/local/bin/dnscontrol" do + action :create + source "https://github.com/StackExchange/dnscontrol/releases/download/v2.10.0/dnscontrol-Linux" + owner "root" + group "root" + mode 0o755 +end + directory "/srv/dns.openstreetmap.org" do owner "root" group "root" @@ -109,6 +117,14 @@ directory "/var/lib/dns" do notifies :run, "execute[dns-update]" end +template "/var/lib/dns/creds.json" do + source "creds.json.erb" + owner "git" + group "git" + mode 0o440 + variables :passwords => passwords +end + cookbook_file "#{node[:dns][:repository]}/hooks/post-receive" do source "post-receive" owner "git" diff --git a/cookbooks/dns/templates/default/creds.json.erb b/cookbooks/dns/templates/default/creds.json.erb new file mode 100644 index 000000000..980c0fb38 --- /dev/null +++ b/cookbooks/dns/templates/default/creds.json.erb @@ -0,0 +1,11 @@ +{ + "gandi_v5": { + "apikey": "<%= @passwords["gandi"] %>", + "sharing_id": "7028b616-ba65-11e7-8343-00163ec31f40" + }, + "cloudflare": { + "accountid": "049c95aba02c95fc1e78a9d255282e0f", + "accountname": "OpenStreetMap", + "apitoken": "<%= @passwords["cloudflare"] %>" + } +} -- 2.39.5