X-Git-Url: https://git.openstreetmap.org/chef.git/blobdiff_plain/8887ebd0cf98da6d76711fcc2fad4e46f18123a3..a31229e5ab1291d79d14ac9bf4ad210db4895cea:/cookbooks/networking/recipes/default.rb?ds=sidebyside diff --git a/cookbooks/networking/recipes/default.rb b/cookbooks/networking/recipes/default.rb index 39611a9df..e23b1dae3 100644 --- a/cookbooks/networking/recipes/default.rb +++ b/cookbooks/networking/recipes/default.rb @@ -22,7 +22,12 @@ require "ipaddr" +network_packages = [] + node[:networking][:interfaces].each do |name, interface| + network_packages |= ["vlan"] if interface[:interface] =~ /\.\d+$/ + network_packages |= ["ifenslave"] if interface[:bond] + if interface[:role] && (role = node[:networking][:roles][interface[:role]]) if role[interface[:family]] node.set[:networking][:interfaces][name][:prefix] = role[interface[:family]][:prefix] @@ -35,12 +40,12 @@ node[:networking][:interfaces].each do |name, interface| 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 +package network_packages + template "/etc/network/interfaces" do source "interfaces.erb" owner "root" @@ -209,7 +214,7 @@ firewall_rule "limit-icmp-echo" do rate_limit "s:1/sec:5" end -%w(ucl ic bm).each do |zone| +%w(ucl ic bm aws).each do |zone| firewall_rule "accept-openvpn-#{zone}" do action :accept family :inet