|
# <%= @name %>
|
|
subnet <%= @network %> netmask <%= @mask %> {
|
|
<% if (@range && @range.is_a?(String) && !@range.strip.empty?) || (@range && @range.is_a?(Array)) -%>
|
|
pool
|
|
{
|
|
<% if @failover && !@failover.strip.empty? -%>
|
|
failover peer "<%= @failover %>";
|
|
<% end -%>
|
|
<% if @pool_parameters.is_a? Array -%>
|
|
<% @pool_parameters.each do |param| -%>
|
|
<%= param %>;
|
|
<% end -%>
|
|
<% elsif @pool_parameters && !@pool_parameters.strip.empty? -%>
|
|
<%= @pool_parameters %>;
|
|
<% end -%>
|
|
<% if @range and @range.is_a? Array -%>
|
|
<% @range.each do |rng| -%>
|
|
range <%= rng %>;
|
|
<% end -%>
|
|
<% elsif @range && !@range.strip.empty? -%>
|
|
range <%= @range %>;
|
|
<% end -%>
|
|
}
|
|
<% end -%>
|
|
|
|
<% if @domain_name && !@domain_name.strip.empty? -%>
|
|
option domain-name "<%= @domain_name %>";
|
|
<% end -%>
|
|
option subnet-mask <%= @mask %>;
|
|
<% if @gateway && !@gateway.strip.empty? -%>
|
|
option routers <%= @gateway %>;
|
|
<% end -%>
|
|
<% if @static_routes
|
|
['rfc3442', 'ms'].each do |static_route_prefix| -%>
|
|
option <%= static_route_prefix %>-classless-static-routes <% -%>
|
|
<% @static_routes.each_with_index do |static_route, static_route_index| -%>
|
|
<%= static_route['mask'] %>, <% -%>
|
|
<% if static_route['network'] && !static_route['network'].split('.').empty? -%>
|
|
<%= static_route['network'].split('.').join(', ')%>, <% -%>
|
|
<% end -%>
|
|
<%= static_route['gateway'].split('.').join(', ') -%>
|
|
<% if static_route_index + 1 < @static_routes.length %>, <% -%>
|
|
<% else %>;<% -%>
|
|
<% end -%>
|
|
<% end %>
|
|
<% end -%>
|
|
<% end -%>
|
|
<% if @options.is_a? Array -%>
|
|
<% @options.each do |opt| -%>
|
|
option <%= opt %>;
|
|
<% end -%>
|
|
<% elsif @options && !@options.strip.empty? -%>
|
|
option <%= @options %>;
|
|
<% end -%>
|
|
<% if @parameters.is_a? Array -%>
|
|
<% @parameters.each do |param| -%>
|
|
<%= param %>;
|
|
<% end -%>
|
|
<% elsif @parameters && !@parameters.strip.empty? -%>
|
|
<%= @parameters %>;
|
|
<% end -%>
|
|
<% if @nameservers and @nameservers.is_a? Array -%>
|
|
option domain-name-servers <%= @nameservers.sort.join(', ') %>;
|
|
<% elsif @nameservers -%>
|
|
option domain-name-servers <%= @nameservers %>;
|
|
<% end -%>
|
|
<% if @search_domains and @search_domains.is_a? Array -%>
|
|
option domain-search "<%= @search_domains.sort.join('", "') %>";
|
|
<% elsif @search_domains -%>
|
|
option domain-search "<%= @search_domains.split(/[, ]+/).join('", "') %>";
|
|
<% end -%>
|
|
<% if @mtu -%>
|
|
option interface-mtu <%= @mtu %>;
|
|
<% end -%>
|
|
<% if @pxeserver -%>
|
|
next-server <%= @pxeserver %>;
|
|
<% end -%>
|
|
}
|
|
|