]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/networking/recipes/default.rb
Explcitly disable IPv6 on the IC internal network
[chef.git] / cookbooks / networking / recipes / default.rb
index 39611a9dfdb0e2aa5bde681cb40bbd2aa8921a9d..67d7bcf3e0ad667324e22fa87bffcd15c4a11c31 100644 (file)
@@ -25,6 +25,7 @@ require "ipaddr"
 node[:networking][:interfaces].each do |name, interface|
   if interface[:role] && (role = node[:networking][:roles][interface[:role]])
     if role[interface[:family]]
+      node.set[:networking][:interfaces][name][:method] = role[interface[:family]][:method]
       node.set[:networking][:interfaces][name][:prefix] = role[interface[:family]][:prefix]
       node.set[:networking][:interfaces][name][:gateway] = role[interface[:family]][:gateway]
     end
@@ -33,12 +34,14 @@ node[:networking][:interfaces].each do |name, interface|
     node.set[:networking][:interfaces][name][:zone] = role[:zone]
   end
 
+  node.set_unless[:networking][:interfaces][name][:method] = "static"
+
+  next unless interface[:address]
+
   prefix = node[:networking][:interfaces][name][:prefix]
 
-  # rubocop:disable Style/RedundantParentheses
   node.set[:networking][:interfaces][name][:netmask] = (~IPAddr.new(interface[:address]).mask(0)).mask(prefix)
   node.set[:networking][:interfaces][name][:network] = IPAddr.new(interface[:address]).mask(prefix)
-  # rubocop:enable Style/RedundantParentheses
 end
 
 template "/etc/network/interfaces" do