]> git.openstreetmap.org Git - chef.git/commitdiff
Explcitly disable IPv6 on the IC internal network
authorTom Hughes <tom@compton.nu>
Mon, 21 Mar 2016 12:46:27 +0000 (12:46 +0000)
committerTom Hughes <tom@compton.nu>
Mon, 21 Mar 2016 12:46:27 +0000 (12:46 +0000)
cookbooks/networking/recipes/default.rb
cookbooks/networking/templates/default/interfaces.erb
roles/ic.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
index 89fc316eb4aa1810321eda4af1787a498c9c8bdb..33cc6620f529949f60fbad54a63fa6866bc804bc 100644 (file)
@@ -3,8 +3,10 @@
 iface lo inet loopback
 <% node[:networking][:interfaces].each do |name,interface| -%>
 
-iface <%= interface[:interface] %> <%= interface[:family] %> static
+iface <%= interface[:interface] %> <%= interface[:family] %> <%= interface[:method] %>
+<% if interface[:address] -%>
       address   <%= interface[:address] %>
+<% end -%>
 <% if interface[:family] == "inet" -%>
       netmask   <%= interface[:netmask] %>
 <% elsif interface[:family] == "inet6" -%>
index af78c9f2395e0230136d9880153d9c39268c0a50..ea4d17b7a6814d58f34ba64de44cc7c78a389e68 100644 (file)
@@ -14,6 +14,9 @@ default_attributes(
         :inet => {
           :prefix => "27",
           :gateway => "146.179.159.177"
+        },
+        :inet6 => {
+          :method => "manual"
         }
       },
       :external => {