From 68b0642c21a598b6f5aecfedd38cc1584737fbec Mon Sep 17 00:00:00 2001 From: Cédric Jeanneret Date: Thu, 4 Nov 2010 14:02:31 +0100 Subject: New module: dhcp Install and manage a dhcp server with puppet. Please read manifests/classes/dhcp.pp for more informations about usage. --- templates/dhcpd.conf.squeeze.erb | 31 +++++++++++++++++++++++++++++++ templates/host.conf.erb | 8 ++++++++ templates/subnet.conf.erb | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 templates/dhcpd.conf.squeeze.erb create mode 100644 templates/host.conf.erb create mode 100644 templates/subnet.conf.erb (limited to 'templates') diff --git a/templates/dhcpd.conf.squeeze.erb b/templates/dhcpd.conf.squeeze.erb new file mode 100644 index 0000000..865c04c --- /dev/null +++ b/templates/dhcpd.conf.squeeze.erb @@ -0,0 +1,31 @@ +# File managed by puppet + +# The ddns-updates-style parameter controls whether or not the server will +# attempt to do a DNS update when a lease is confirmed. We default to the +# behavior of the version 2 packages ('none', since DHCP v2 didn't +# have support for DDNS.) +<% if has_variable?('dhcpd_ddns_update') -%> +ddns-update-style <%=dhcpd_ddns_update%>; +<% else -%> +ddns-update-style none; +<% end -%> + +# option definitions common to all supported networks... +option domain-name "<%=dhcpd_domain_name%>"; +option domain-name-servers <%=dhcpd_dns_servers%>; + +default-lease-time 600; +max-lease-time 7200; + +# If this DHCP server is the official DHCP server for the local +# network, the authoritative directive should be uncommented. +<% if has_variable?('dhcpd_ddns_authoritative') -%> +authoritative; +<% else -%> +#authoritative; +<% end -%> + +# Use this to send dhcp log messages to a different log file (you also +# have to hack syslog.conf to complete the redirection). +log-facility local7; + diff --git a/templates/host.conf.erb b/templates/host.conf.erb new file mode 100644 index 0000000..2cdb4af --- /dev/null +++ b/templates/host.conf.erb @@ -0,0 +1,8 @@ +host <%=name%> { + hardware ethernet <%=mac%>; +<% if fixed_address -%> + fixed-address <%=fixed_address%>; +<% else -%> + fixed-address <%=name%>; +<% end -%> +} diff --git a/templates/subnet.conf.erb b/templates/subnet.conf.erb new file mode 100644 index 0000000..a0a9d29 --- /dev/null +++ b/templates/subnet.conf.erb @@ -0,0 +1,39 @@ +# File managed by puppet + +<% if netmask -%> +subnet <%=name%> netmask <%=netmask%> { +<% else -%> +subnet <%=name%> netmask <%=netmask_eth0%> { +<% end -%> +<% if routeurs -%> + option routers <%=routeurs%>; +<% else -%> + option routers <%=network_eth0%>; +<% end -%> +<% if subnet_mask -%> + option subnet-mask <%=subnet_mask%>; +<% else -%> + option subnet-mask <%=netmask%>; +<% end -%> + option broadcast-address <%=bcast%>; + option domain-name-servers <%=dns%>; +<% if domain_name -%> + option domain-name "<%=domain_name%>"; +<% else -%> + option domain-name "<%=domain%>"; +<% end -%> +<% if netbios_dns -%> + option netbios-name-servers <%=netbios_dns%>; +<% else -%> + option netbios-name-servers <%=network_eth0%>; +<% end -%> +<% if deny -%> + deny <%=deny%>; +<% end -%> +<% if inc -%> + include "<%=to_inc%>"; +<% end -%> +<% if other_opt and not other_opt.empty? -%> +<%= other_opt.collect! {|i| " #{i}" }.join("\n") -%> +<% end %> +} -- cgit v1.2.3