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
owner "root"
group "root"
mode 0o644
+ variables :ipv4_clients => ipv4_clients, :ipv6_clients => ipv6_clients
notifies :restart, "service[bind9]"
end
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;
-<% node.interfaces(:family => :inet6).each do |interface| -%>
- <%= interface[:network] %>/<%= interface[:prefix] %>;
+<% @ipv6_clients.sort.each do |address| -%>
+ <%= address %>/128;
<% end -%>
};
description "Master role applied to grisu"
default_attributes(
+ :bind => {
+ :clients => "bytemark"
+ },
:networking => {
:interfaces => {
:internal_ipv4 => {
:apt => {
:sources => ["ubuntugis-unstable"]
},
+ :bind => {
+ :clients => "equinix"
+ },
:dhcpd => {
:first_address => "10.0.63.1",
:last_address => "10.0.63.254"
description "Master role applied to ridley"
default_attributes(
+ :bind => {
+ :clients => "ucl"
+ },
:dhcpd => {
:first_address => "10.0.15.1",
:last_address => "10.0.15.254"