]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/networking/templates/default/interfaces.erb
Add support for bonding and VLANs
[chef.git] / cookbooks / networking / templates / default / interfaces.erb
index 89fc316eb4aa1810321eda4af1787a498c9c8bdb..1b3e1a9890a88e8db62cf78c8fa0523af64e70ca 100644 (file)
@@ -2,6 +2,7 @@
 
 iface lo inet loopback
 <% node[:networking][:interfaces].each do |name,interface| -%>
+<% if interface[:interface] -%>
 
 iface <%= interface[:interface] %> <%= interface[:family] %> static
       address   <%= interface[:address] %>
@@ -30,6 +31,15 @@ iface <%= interface[:interface] %> <%= interface[:family] %> static
 <% if interface[:family] == "inet6" -%>
       autoconf  0
 <% end -%>
+<% if interface[:bond] -%>
+      bond-mode <%= interface[:bond][:mode] || "active-backup" %>
+      bond-slaves <%= interface[:bond][:slaves].join(" ") %>
+      bond-primary <%= interface[:bond][:slaves].first %>
+      bond-miimon <%= interface[:bond][:miimon] || 100 %>
+      bond-downdelay <%= interface[:bond][:downdelay] || 200 %>
+      bond-updelay <%= interface[:bond][:updelay] || 200 %>
+<% end -%>
+<% end -%>
 <% end -%>
 
-auto lo <%= node[:networking][:interfaces].collect { |n,i| i[:interface] }.sort.uniq.join(" ") %>
+auto lo <%= node[:networking][:interfaces].collect { |n,i| i[:interface] }.compact.sort.uniq.join(" ") %>