From aa02df0d2f61fb4d1839e1e9fca1ec95c249572a Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Mon, 21 Mar 2016 12:46:27 +0000 Subject: [PATCH] Explcitly disable IPv6 on the IC internal network --- cookbooks/networking/recipes/default.rb | 7 +++++-- cookbooks/networking/templates/default/interfaces.erb | 4 +++- roles/ic.rb | 3 +++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/cookbooks/networking/recipes/default.rb b/cookbooks/networking/recipes/default.rb index 39611a9df..67d7bcf3e 100644 --- a/cookbooks/networking/recipes/default.rb +++ b/cookbooks/networking/recipes/default.rb @@ -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 diff --git a/cookbooks/networking/templates/default/interfaces.erb b/cookbooks/networking/templates/default/interfaces.erb index 89fc316eb..33cc6620f 100644 --- a/cookbooks/networking/templates/default/interfaces.erb +++ b/cookbooks/networking/templates/default/interfaces.erb @@ -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" -%> diff --git a/roles/ic.rb b/roles/ic.rb index af78c9f23..ea4d17b7a 100644 --- a/roles/ic.rb +++ b/roles/ic.rb @@ -14,6 +14,9 @@ default_attributes( :inet => { :prefix => "27", :gateway => "146.179.159.177" + }, + :inet6 => { + :method => "manual" } }, :external => { -- 2.39.5