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

30 lines
915 B
Plaintext
Raw Normal View History

2014-01-21 22:11:25 +00:00
# dhcpd.conf for <%= @node.name %> managed by Chef. Changes will be overwritten.
2014-01-19 14:34:01 +00:00
default-lease-time 600;
max-lease-time 7200;
2014-01-27 10:13:56 +00:00
<% 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 %>
2014-01-19 14:34:01 +00:00
2014-01-21 22:11:25 +00:00
subnet <%= @node.dhcp.subnet.prefix %> netmask <%= @node.dhcp.subnet.netmask%> {
option routers <%= @node.dhcp.subnet.gateway%>;
}
2014-01-27 10:13:56 +00:00
<% @node.dhcp.hosts.each do |name, host| -%>
host <%= name %> {
2014-01-21 22:11:25 +00:00
hardware ethernet <%= host.mac %>;
2014-01-27 10:13:56 +00:00
<% if host.attribute?("ip") %>
fixed-address <%= "#{host.ip}" %>;
<% else %>
fixed-address <%= "#{name}.#{@node.dhcp.domain.names.first}" %>;
<% end %>
2014-01-21 22:11:25 +00:00
use-host-decl-names true;
}
2014-01-19 14:34:01 +00:00
<% end -%>