Add support for bonding and VLANs
[chef.git] / cookbooks / networking / recipes / default.rb
index fe01c04e5634919c7d15c04c41b524805e535d20..e23b1dae313b13beaed885d8edde69ed67d2fdca 100644 (file)
 
 require "ipaddr"
 
+network_packages = []
+
 node[:networking][:interfaces].each do |name, interface|
-  if interface[:role] && role = node[:networking][:roles][interface[:role]]
+  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]
       node.set[:networking][:interfaces][name][:gateway] = role[interface[:family]][:gateway]
@@ -39,6 +44,8 @@ node[:networking][:interfaces].each do |name, interface|
   node.set[:networking][:interfaces][name][:network] = IPAddr.new(interface[:address]).mask(prefix)
 end
 
+package network_packages
+
 template "/etc/network/interfaces" do
   source "interfaces.erb"
   owner "root"
@@ -207,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