chef-lctp/site-cookbooks/dhcp/templates/default/dhcpd.conf.erb

30 lines
915 B
Plaintext

# dhcpd.conf for <%= @node.name %> managed by Chef. Changes will be overwritten.
default-lease-time 600;
max-lease-time 7200;
<% if @node.dhcp.domain.names.size > 0 %>
option domain-name <%= @node.dhcp.domain.names.join(" ") %>;
<% end %>
<% if @node.dhcp.domain.servers.size > 0 %>
option domain-name-servers <%= @node.dhcp.domain.servers.join(" ") %>;
<% end %>
<% if @node.dhcp.ntp_servers.size > 0 %>
option ntp-servers <%= @node.dhcp.ntp_servers.join(" ") %>;
<% end %>
subnet <%= @node.dhcp.subnet.prefix %> netmask <%= @node.dhcp.subnet.netmask%> {
option routers <%= @node.dhcp.subnet.gateway%>;
}
<% @node.dhcp.hosts.each do |name, host| -%>
host <%= name %> {
hardware ethernet <%= host.mac %>;
<% if host.attribute?("ip") %>
fixed-address <%= "#{host.ip}" %>;
<% else %>
fixed-address <%= "#{name}.#{@node.dhcp.domain.names.first}" %>;
<% end %>
use-host-decl-names true;
}
<% end -%>