]> git.openstreetmap.org Git - chef.git/commitdiff
Allow grisu to provide DNS service to all bytemark machines
authorTom Hughes <tom@compton.nu>
Wed, 26 Jun 2019 17:36:51 +0000 (18:36 +0100)
committerTom Hughes <tom@compton.nu>
Wed, 26 Jun 2019 17:43:03 +0000 (18:43 +0100)
cookbooks/bind/recipes/default.rb
cookbooks/bind/templates/default/named.options.erb
roles/grisu.rb
roles/ironbelly.rb
roles/ridley.rb

index 4dcfaa8591400186a4e0e0923002ba62d97ae80e..44d3643201003ca4c62e005518ed004662e7d346 100644 (file)
 
 include_recipe "networking"
 
 
 include_recipe "networking"
 
+clients = search(:node, "roles:#{node[:bind][:clients]}")
+
+ipv4_clients = clients.collect do |client|
+  client.ipaddresses(:family => :inet)
+end.flatten
+
+ipv6_clients = clients.collect do |client|
+  client.ipaddresses(:family => :inet6)
+end.flatten
+
 package "bind9"
 
 service "bind9" do
 package "bind9"
 
 service "bind9" do
@@ -39,6 +49,7 @@ template "/etc/bind/named.conf.options" do
   owner "root"
   group "root"
   mode 0o644
   owner "root"
   group "root"
   mode 0o644
+  variables :ipv4_clients => ipv4_clients, :ipv6_clients => ipv6_clients
   notifies :restart, "service[bind9]"
 end
 
   notifies :restart, "service[bind9]"
 end
 
index a2bd23dbb9f43374adb4d4286dfc268db0329caa..f9cebbc10affb7e7c99fffa92e7de366e40b57c5 100644 (file)
@@ -2,13 +2,13 @@
 
 acl "osm" {
        127.0.0.1/32;
 
 acl "osm" {
        127.0.0.1/32;
-<% node.interfaces(:family => :inet).each do |interface| -%>
-       <%= interface[:network] %>/<%= interface[:prefix] %>;
+<% @ipv4_clients.sort.each do |address| -%>
+       <%= address %>/32;
 <% end -%>
 
        ::1/128;
 <% end -%>
 
        ::1/128;
-<% node.interfaces(:family => :inet6).each do |interface| -%>
-       <%= interface[:network] %>/<%= interface[:prefix] %>;
+<% @ipv6_clients.sort.each do |address| -%>
+       <%= address %>/128;
 <% end -%>
 };
 
 <% end -%>
 };
 
index be3a48e3f3954443c5a7b5cb6493a9524514a29c..8e177a8ff49ea2781610271c2015f8c0236587d8 100644 (file)
@@ -2,6 +2,9 @@ name "grisu"
 description "Master role applied to grisu"
 
 default_attributes(
 description "Master role applied to grisu"
 
 default_attributes(
+  :bind => {
+    :clients => "bytemark"
+  },
   :networking => {
     :interfaces => {
       :internal_ipv4 => {
   :networking => {
     :interfaces => {
       :internal_ipv4 => {
index 8bc758e762fa42769919200490bf3b6f8ff7d288..2f05572fb1009330586ea4db84ffbe34f1ef5494 100644 (file)
@@ -5,6 +5,9 @@ default_attributes(
   :apt => {
     :sources => ["ubuntugis-unstable"]
   },
   :apt => {
     :sources => ["ubuntugis-unstable"]
   },
+  :bind => {
+    :clients => "equinix"
+  },
   :dhcpd => {
     :first_address => "10.0.63.1",
     :last_address => "10.0.63.254"
   :dhcpd => {
     :first_address => "10.0.63.1",
     :last_address => "10.0.63.254"
index ec985da04a56922af308e3b56770e18e738b8064..591f31ae2fd00fb7936f73a35e5b84313c03cb93 100644 (file)
@@ -2,6 +2,9 @@ name "ridley"
 description "Master role applied to ridley"
 
 default_attributes(
 description "Master role applied to ridley"
 
 default_attributes(
+  :bind => {
+    :clients => "ucl"
+  },
   :dhcpd => {
     :first_address => "10.0.15.1",
     :last_address => "10.0.15.254"
   :dhcpd => {
     :first_address => "10.0.15.1",
     :last_address => "10.0.15.254"