]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/networking/recipes/default.rb
Add support for bonding and VLANs
[chef.git] / cookbooks / networking / recipes / default.rb
index 8355b54c036e68d0b12d4d68e610e10c962c84d1..e23b1dae313b13beaed885d8edde69ed67d2fdca 100644 (file)
 
 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]
@@ -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"