2014-01-27 10:13:56 +00:00
|
|
|
include_recipe "network_interfaces"
|
|
|
|
|
|
|
|
package "ifmetric"
|
|
|
|
|
|
|
|
cookbook_file "/etc/network/interfaces" do
|
|
|
|
source "interfaces"
|
|
|
|
mode 0644
|
|
|
|
owner "root"
|
|
|
|
group "root"
|
|
|
|
end
|
|
|
|
|
|
|
|
network = node.lctp_network
|
|
|
|
|
|
|
|
unless network.domain_servers.empty? and network.search_domains.empty?
|
2014-01-27 10:37:03 +00:00
|
|
|
template "/etc/resolvconf/resolv.conf.d/head" do
|
2014-01-27 10:13:56 +00:00
|
|
|
source "resolv.conf.erb"
|
|
|
|
variables(network: network)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
network.interfaces.each do |device, iface|
|
|
|
|
network_interfaces device do
|
|
|
|
if iface.attribute? "metric"
|
|
|
|
metric iface.metric
|
|
|
|
end
|
|
|
|
|
|
|
|
if iface.attribute? "static_ip"
|
|
|
|
target iface.static_ip
|
|
|
|
|
|
|
|
if iface.attribute? "netmask"
|
|
|
|
mask iface.netmask
|
|
|
|
else
|
|
|
|
mask "255.255.255.0"
|
|
|
|
end
|
|
|
|
|
|
|
|
bootproto "static"
|
|
|
|
else
|
|
|
|
bootproto "dhcp"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|