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