X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/aa02df0d2f61fb4d1839e1e9fca1ec95c249572a..1d23c59f10b2636d9c20b3da441aa22373f88af4:/cookbooks/networking/templates/default/interfaces.erb diff --git a/cookbooks/networking/templates/default/interfaces.erb b/cookbooks/networking/templates/default/interfaces.erb index 33cc6620f..4d1f277e5 100644 --- a/cookbooks/networking/templates/default/interfaces.erb +++ b/cookbooks/networking/templates/default/interfaces.erb @@ -2,11 +2,19 @@ iface lo inet loopback <% node[:networking][:interfaces].each do |name,interface| -%> +<% if interface[:interface] -%> +<% if interface[:bond] -%> +<% interface[:bond][:slaves].each do |slave| -%> -iface <%= interface[:interface] %> <%= interface[:family] %> <%= interface[:method] %> -<% if interface[:address] -%> - address <%= interface[:address] %> +iface <%= slave %> inet manual + bond-master <%= interface[:interface] %> +<% end -%> + +auto <%= interface[:bond][:slaves].sort.uniq.join(" ") %> <% end -%> + +iface <%= interface[:interface] %> <%= interface[:family] %> static + address <%= interface[:address] %> <% if interface[:family] == "inet" -%> netmask <%= interface[:netmask] %> <% elsif interface[:family] == "inet6" -%> @@ -32,6 +40,15 @@ iface <%= interface[:interface] %> <%= interface[:family] %> <%= interface[:meth <% if interface[:family] == "inet6" -%> autoconf 0 <% end -%> +<% if interface[:bond] -%> + bond-mode <%= interface[:bond][:mode] || "active-backup" %> + bond-slaves none + 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(" ") %>