From 1b1650c86cc9ca0616d06721b29630747a930d0f Mon Sep 17 00:00:00 2001 From: Cédric Jeanneret Date: Fri, 5 Nov 2010 14:48:26 +0100 Subject: (dhcp::subnet and associated tmpl) updated documentation and removed many options I decided to remove many options of the definition, and to replace them with a single array. --- manifests/definitions/dhcp-subnet.pp | 58 ++++++++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 16 deletions(-) (limited to 'manifests') diff --git a/manifests/definitions/dhcp-subnet.pp b/manifests/definitions/dhcp-subnet.pp index 46c55ae..066f538 100644 --- a/manifests/definitions/dhcp-subnet.pp +++ b/manifests/definitions/dhcp-subnet.pp @@ -1,22 +1,43 @@ +/* + += Definition: dhcp::subnet +Creates a subnet + +Arguments: + *$broadcast* : subnet broadcast (mandatory) + *$netmask* : subnet netmask (if not set, takes eth0 netmask) + *$routers* : subnet routers (array) (if not set, takes eth0 IP) + *$subnet_mask* : netmask sent to dhcp guests (if not set, takes $netmask, or netmask_eth0) + *$domain_name* : subnet domain name (if not set, takes server domain) + *$other_opts* : any other DHCPD option, as an array + +Example: + +node "dhcp.domain.ltd" { + $dhcpd_domain_name = 'domain.ltd' + $dhcpd_dns_servers = '10.27.21.1, 10.26.21.1' + include dhcp + + dhcp::subnet {"10.27.20.0": + ensure => present, + broadcast => "10.27.20.255", + other_opts => ['filename "pxelinux.0";', 'next-server 10.27.10.1;'], + } +} +*/ define dhcp::subnet( $ensure=present, - $bcast, - $dns, + $broadcast, $netmask=false, - $domain_name=false, - $inc=false, - $routeurs=false, - $netbios_dns=false, + $routers=false, $subnet_mask=false, - $other_opt=false, - $deny=false) { - include dhcp::variables + $domain_name=false, + $other_opts=false) { + include dhcp::params - if $inc { - $to_inc = "${dhcp::variables::config_dir}/hosts.d/${name}.conf" - } + $to_include = "${dhcp::params::config_dir}/hosts.d/${name}.conf" - file {"${dhcp::variables::config_dir}/subnets/${name}.conf": + file {"${dhcp::params::config_dir}/subnets/${name}.conf": ensure => $ensure, owner => root, group => root, @@ -24,10 +45,15 @@ define dhcp::subnet( notify => Service["dhcpd"], } - common::concatfilepart {"${name}": - file => "${dhcp::variables::config_dir}/dhcpd.conf", + common::concatfilepart {"dhcp.${name}": + file => "${dhcp::params::config_dir}/dhcpd.conf", ensure => $ensure, - content => "include \"${dhcp::variables::config_dir}/subnets/${name}.conf\";\n", + content => "include \"${dhcp::params::config_dir}/subnets/${name}.conf\";\n", } + common::concatfilepart {"00.dhcp.${name}.base": + file => $to_include, + ensure => $ensure, + content => "# File managed by puppet\n", + } } -- cgit v1.2.3