voxpupuli / puppet-dhcp Goto Github PK
View Code? Open in Web Editor NEWPuppet module for deploying dhcp
Home Page: https://forge.puppet.com/puppet/dhcp
License: Apache License 2.0
Puppet module for deploying dhcp
Home Page: https://forge.puppet.com/puppet/dhcp
License: Apache License 2.0
Setting up the dhcp class as follows:
Puppet file:
# Forge Modules
mod 'puppetlabs/ntp', '4.1.0'
mod 'puppetlabs/stdlib'
mod 'thias-bind', '0.5.3'
mod 'puppet-dhcp', '3.3.0' #https://forge.puppet.com/puppet/dhcp
mod 'puppetlabs-tftp', '1.0.0' #https://forge.puppet.com/puppetlabs/tftp
mod 'chocolatey-chocolatey', '1.2.6' #https://forge.puppet.com/chocolatey/chocolatey
#mod 'puppet-nginx', '0.14.0' #https://forge.puppet.com/puppet/nginx
mod 'puppetlabs-concat', '5.1.0' #https://forge.puppet.com/puppetlabs/concat
dhcp class
class profile::dhcp(
String $dns_server,
String $gateway,
String $pxe_server,
Array $interfaces,
){
include dhcp
class { 'dhcp':
service_ensure => running,
dnsdomain => [
'network.local',
'0.168.192.in-addr.arpa',
],
nameservers => [$dns_server],
ntpservers => ['192.168.0.1'],
interfaces => $interfaces,
pxeserver => '192.168.0.99',
pxefilename => 'pxelinux.0',
}
dhcp::pool {'sn_192.168.0.0' :
network => '192.168.0.0',
mask => '255.255.255.0',
range => '192.168.0.120 192.168.0.140',
nameservers => [$dns_server],
gateway => $gateway,
pxeserver => $pxe_server,
pxefilename => 'pxelinux.0',
}
}
Node yaml has the following:
# dhcp settings for clients
profile::dhcp::dns_server: '192.168.0.99'
profile::dhcp::gateway: '192.168.0.1'
profile::dhcp::pxe_server: '192.168.0.99'
profile::dhcp::interfaces:
- 'bond-vms'
The compilation error when running the class on the Ubuntu client (18.04)
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Function Call, You need to set $interfaces in dhcp (file: /etc/puppetlabs/code/environments/master/modules/dhcp/manifests/init.pp, line: 104, column: 5) on node grace.network.local
It doesn't seem to matter if use the interface or interfaces I get the same error message.
Thanks
-Nigel
Hi,
In the pool.pp manifest, the options is referred as:
Line 29 in 86a6553
But, in the code, is reported as follows:
Line 74 in 86a6553
Given the YAML
options:
- 'netbios-name-servers 192.168.0.1'
- 'netbios-dd-server 192.168.0.1'
- 'netbios-node-type 8'
- 'ubnt.unifi-address 192.168.0.2'
It is producing the following error:
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Dhcp::Pool[DOMAIN]: parameter 'options' expects a value of type Undef or String, got Tuple (file: /etc/puppetlabs/code/environments/development/modules/dhcp/manifests/init.pp, line: 311) on node FQDN
The following line restore the functionality:
Optional[Array[String]] $options = undef,
As well as
Optional[Variant[Array[String],String[1]]] $options = undef,
Mind that also "parameter" can be an Array, so i believe it's broken as well.
Line 32 in 86a6553
Line 75 in 86a6553
Are possibly other portion of code with the same mistake?
Before pushing a PR, i would like to get a review...
Add a parameter to set per-architecture (boot) filenames in the DHCP config, e.g.
option architecture code 93 = unsigned integer 16 ;
if option architecture = 00:00 {
filename "pxelinux.0";
} elsif option architecture = 00:06 {
filename "shim.efi";
} else {
filename "mypxefilename";
}
In theforeman/dhcp, a $bootfiles
hash has filenames keyed by architecture codes: theforeman/puppet-dhcp@6d01407
On FreeBSD, the dhcpd_ifaces setting in rc.conf should be set to a space-separated list of network interfaces for the DHCP daemon to listen on.
Based on theforeman/puppet-dhcp@d66778c#diff-60ae41fd0a31977447947f59940ee9a4R67.
When a host mac address contains only numeric values processing fails. For example:
mac: 00:07:43:14:16:70
The following line in the template lcoated in puppetlabs-dhcp/templates/dhcpd.host.erb
causes the issue, because it can't do the operation when only numeric values exist.
hardware ethernet <%= @mac.upcase %>;
It should work on any valid mac address.
Debug: template[/etc/puppet/modules/dhcp/templates/dhcpd.host.erb]: Bound template variables for /etc/puppet/modules/dhcp/templates/dhcpd.host.erb in 0.00 seconds
Error: Failed to parse template dhcp/dhcpd.host.erb:
Filepath: /etc/puppet/modules/dhcp/templates/dhcpd.host.erb
Line: 2
Detail: undefined method `upcase' for 6535303:Fixnum
at /etc/puppet/modules/dhcp/manifests/host.pp:20 on node aa7edca96e89.c2r1.openstack.tld
/usr/share/ruby/vendor_ruby/puppet/parser/functions/template.rb:26:in `rescue in block (2 levels) in <top (required)>'
/usr/share/ruby/vendor_ruby/puppet/parser/functions/template.rb:22:in `block (2 levels) in <top (required)>'
/usr/share/ruby/vendor_ruby/puppet/parser/functions/template.rb:15:in `collect'
/usr/share/ruby/vendor_ruby/puppet/parser/functions/template.rb:15:in `block in <top (required)>'
/usr/share/ruby/vendor_ruby/puppet/parser/functions.rb:164:in `block (2 levels) in newfunction'
/usr/share/ruby/vendor_ruby/puppet/util/profiler/around_profiler.rb:58:in `profile'
/usr/share/ruby/vendor_ruby/puppet/util/profiler.rb:51:in `profile'
/usr/share/ruby/vendor_ruby/puppet/parser/functions.rb:157:in `block in newfunction'
/usr/share/ruby/vendor_ruby/puppet/parser/ast/function.rb:42:in `evaluate'
/usr/share/ruby/vendor_ruby/puppet/parser/ast.rb:61:in `safeevaluate'
/usr/share/ruby/vendor_ruby/puppet/parser/ast/resourceparam.rb:14:in `evaluate'
/usr/share/ruby/vendor_ruby/puppet/parser/ast.rb:61:in `safeevaluate'
/usr/share/ruby/vendor_ruby/puppet/parser/ast/resource.rb:29:in `block (2 levels) in evaluate'
/usr/share/ruby/vendor_ruby/puppet/parser/ast/branch.rb:12:in `block in each'
/usr/share/ruby/vendor_ruby/puppet/parser/ast/branch.rb:11:in `each'
/usr/share/ruby/vendor_ruby/puppet/parser/ast/branch.rb:11:in `each'
/usr/share/ruby/vendor_ruby/puppet/parser/ast/resource.rb:28:in `collect'
/usr/share/ruby/vendor_ruby/puppet/parser/ast/resource.rb:28:in `block in evaluate'
/usr/share/ruby/vendor_ruby/puppet/parser/ast/branch.rb:12:in `block in each'
/usr/share/ruby/vendor_ruby/puppet/parser/ast/branch.rb:11:in `each'
/usr/share/ruby/vendor_ruby/puppet/parser/ast/branch.rb:11:in `each'
/usr/share/ruby/vendor_ruby/puppet/parser/ast/resource.rb:25:in `collect'
/usr/share/ruby/vendor_ruby/puppet/parser/ast/resource.rb:25:in `evaluate'
/usr/share/ruby/vendor_ruby/puppet/parser/ast.rb:61:in `safeevaluate'
/usr/share/ruby/vendor_ruby/puppet/parser/ast/block_expression.rb:11:in `block in evaluate'
/usr/share/ruby/vendor_ruby/puppet/parser/ast/block_expression.rb:10:in `each'
/usr/share/ruby/vendor_ruby/puppet/parser/ast/block_expression.rb:10:in `evaluate'
/usr/share/ruby/vendor_ruby/puppet/parser/ast.rb:61:in `safeevaluate'
/usr/share/ruby/vendor_ruby/puppet/resource/type.rb:129:in `evaluate_code'
/usr/share/ruby/vendor_ruby/puppet/parser/resource.rb:81:in `block in evaluate'
/usr/share/ruby/vendor_ruby/puppet/util/profiler/around_profiler.rb:58:in `profile'
/usr/share/ruby/vendor_ruby/puppet/util/profiler.rb:51:in `profile'
/usr/share/ruby/vendor_ruby/puppet/parser/resource.rb:77:in `evaluate'
/usr/share/ruby/vendor_ruby/puppet/parser/compiler.rb:386:in `block (3 levels) in evaluate_definitions'
/usr/share/ruby/vendor_ruby/puppet/parser/compiler.rb:385:in `each'
/usr/share/ruby/vendor_ruby/puppet/parser/compiler.rb:385:in `block (2 levels) in evaluate_definitions'
/usr/share/ruby/vendor_ruby/puppet/util/profiler/around_profiler.rb:58:in `profile'
/usr/share/ruby/vendor_ruby/puppet/util/profiler.rb:51:in `profile'
/usr/share/ruby/vendor_ruby/puppet/parser/compiler.rb:384:in `block in evaluate_definitions'
/usr/share/ruby/vendor_ruby/puppet/util/errors.rb:64:in `exceptwrap'
/usr/share/ruby/vendor_ruby/puppet/parser/compiler.rb:383:in `evaluate_definitions'
/usr/share/ruby/vendor_ruby/puppet/parser/compiler.rb:404:in `block (2 levels) in evaluate_generators'
/usr/share/ruby/vendor_ruby/puppet/util/profiler/around_profiler.rb:58:in `profile'
/usr/share/ruby/vendor_ruby/puppet/util/profiler.rb:51:in `profile'
/usr/share/ruby/vendor_ruby/puppet/parser/compiler.rb:401:in `block in evaluate_generators'
/usr/share/ruby/vendor_ruby/puppet/parser/compiler.rb:398:in `loop'
/usr/share/ruby/vendor_ruby/puppet/parser/compiler.rb:398:in `evaluate_generators'
/usr/share/ruby/vendor_ruby/puppet/parser/compiler.rb:141:in `block (2 levels) in compile'
/usr/share/ruby/vendor_ruby/puppet/util/profiler/around_profiler.rb:58:in `profile'
/usr/share/ruby/vendor_ruby/puppet/util/profiler.rb:51:in `profile'
/usr/share/ruby/vendor_ruby/puppet/parser/compiler.rb:141:in `block in compile'
/usr/share/ruby/vendor_ruby/puppet/context.rb:64:in `override'
/usr/share/ruby/vendor_ruby/puppet.rb:246:in `override'
/usr/share/ruby/vendor_ruby/puppet/parser/compiler.rb:121:in `compile'
/usr/share/ruby/vendor_ruby/puppet/parser/compiler.rb:34:in `compile'
/usr/share/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:95:in `block (2 levels) in compile'
/usr/share/ruby/vendor_ruby/puppet/util/profiler/around_profiler.rb:58:in `profile'
/usr/share/ruby/vendor_ruby/puppet/util/profiler.rb:51:in `profile'
/usr/share/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:93:in `block in compile'
/usr/share/ruby/vendor_ruby/puppet/util.rb:161:in `block in benchmark'
/usr/share/ruby/benchmark.rb:296:in `realtime'
/usr/share/ruby/vendor_ruby/puppet/util.rb:160:in `benchmark'
/usr/share/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:92:in `compile'
/usr/share/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:52:in `find'
/usr/share/ruby/vendor_ruby/puppet/indirector/indirection.rb:201:in `find'
/usr/share/ruby/vendor_ruby/puppet/application/apply.rb:222:in `block in main'
/usr/share/ruby/vendor_ruby/puppet/context.rb:64:in `override'
/usr/share/ruby/vendor_ruby/puppet.rb:246:in `override'
/usr/share/ruby/vendor_ruby/puppet/application/apply.rb:198:in `main'
/usr/share/ruby/vendor_ruby/puppet/application/apply.rb:159:in `run_command'
/usr/share/ruby/vendor_ruby/puppet/application.rb:381:in `block (2 levels) in run'
/usr/share/ruby/vendor_ruby/puppet/application.rb:507:in `plugin_hook'
/usr/share/ruby/vendor_ruby/puppet/application.rb:381:in `block in run'
/usr/share/ruby/vendor_ruby/puppet/util.rb:496:in `exit_on_fail'
/usr/share/ruby/vendor_ruby/puppet/application.rb:381:in `run'
/usr/share/ruby/vendor_ruby/puppet/util/command_line.rb:146:in `run'
/usr/share/ruby/vendor_ruby/puppet/util/command_line.rb:92:in `execute'
/usr/bin/puppet:8:in `<main>'
Error: Failed to parse template dhcp/dhcpd.host.erb:
Filepath: /etc/puppet/modules/dhcp/templates/dhcpd.host.erb
Line: 2
Detail: undefined method `upcase' for 6535303:Fixnum
at /etc/puppet/modules/dhcp/manifests/host.pp:20 on node aa7edca96e89.c2r1.openstack.tld
/usr/share/ruby/vendor_ruby/puppet/parser/functions/template.rb:26:in `rescue in block (2 levels) in <top (required)>'
/usr/share/ruby/vendor_ruby/puppet/parser/functions/template.rb:22:in `block (2 levels) in <top (required)>'
/usr/share/ruby/vendor_ruby/puppet/parser/functions/template.rb:15:in `collect'
/usr/share/ruby/vendor_ruby/puppet/parser/functions/template.rb:15:in `block in <top (required)>'
/usr/share/ruby/vendor_ruby/puppet/parser/functions.rb:164:in `block (2 levels) in newfunction'
/usr/share/ruby/vendor_ruby/puppet/util/profiler/around_profiler.rb:58:in `profile'
/usr/share/ruby/vendor_ruby/puppet/util/profiler.rb:51:in `profile'
/usr/share/ruby/vendor_ruby/puppet/parser/functions.rb:157:in `block in newfunction'
/usr/share/ruby/vendor_ruby/puppet/parser/ast/function.rb:42:in `evaluate'
/usr/share/ruby/vendor_ruby/puppet/parser/ast.rb:61:in `safeevaluate'
/usr/share/ruby/vendor_ruby/puppet/parser/ast/resourceparam.rb:14:in `evaluate'
/usr/share/ruby/vendor_ruby/puppet/parser/ast.rb:61:in `safeevaluate'
/usr/share/ruby/vendor_ruby/puppet/parser/ast/resource.rb:29:in `block (2 levels) in evaluate'
/usr/share/ruby/vendor_ruby/puppet/parser/ast/branch.rb:12:in `block in each'
/usr/share/ruby/vendor_ruby/puppet/parser/ast/branch.rb:11:in `each'
/usr/share/ruby/vendor_ruby/puppet/parser/ast/branch.rb:11:in `each'
/usr/share/ruby/vendor_ruby/puppet/parser/ast/resource.rb:28:in `collect'
/usr/share/ruby/vendor_ruby/puppet/parser/ast/resource.rb:28:in `block in evaluate'
/usr/share/ruby/vendor_ruby/puppet/parser/ast/branch.rb:12:in `block in each'
/usr/share/ruby/vendor_ruby/puppet/parser/ast/branch.rb:11:in `each'
/usr/share/ruby/vendor_ruby/puppet/parser/ast/branch.rb:11:in `each'
/usr/share/ruby/vendor_ruby/puppet/parser/ast/resource.rb:25:in `collect'
/usr/share/ruby/vendor_ruby/puppet/parser/ast/resource.rb:25:in `evaluate'
/usr/share/ruby/vendor_ruby/puppet/parser/ast.rb:61:in `safeevaluate'
/usr/share/ruby/vendor_ruby/puppet/parser/ast/block_expression.rb:11:in `block in evaluate'
/usr/share/ruby/vendor_ruby/puppet/parser/ast/block_expression.rb:10:in `each'
/usr/share/ruby/vendor_ruby/puppet/parser/ast/block_expression.rb:10:in `evaluate'
/usr/share/ruby/vendor_ruby/puppet/parser/ast.rb:61:in `safeevaluate'
/usr/share/ruby/vendor_ruby/puppet/resource/type.rb:129:in `evaluate_code'
/usr/share/ruby/vendor_ruby/puppet/parser/resource.rb:81:in `block in evaluate'
/usr/share/ruby/vendor_ruby/puppet/util/profiler/around_profiler.rb:58:in `profile'
/usr/share/ruby/vendor_ruby/puppet/util/profiler.rb:51:in `profile'
/usr/share/ruby/vendor_ruby/puppet/parser/resource.rb:77:in `evaluate'
/usr/share/ruby/vendor_ruby/puppet/parser/compiler.rb:386:in `block (3 levels) in evaluate_definitions'
/usr/share/ruby/vendor_ruby/puppet/parser/compiler.rb:385:in `each'
/usr/share/ruby/vendor_ruby/puppet/parser/compiler.rb:385:in `block (2 levels) in evaluate_definitions'
/usr/share/ruby/vendor_ruby/puppet/util/profiler/around_profiler.rb:58:in `profile'
/usr/share/ruby/vendor_ruby/puppet/util/profiler.rb:51:in `profile'
/usr/share/ruby/vendor_ruby/puppet/parser/compiler.rb:384:in `block in evaluate_definitions'
/usr/share/ruby/vendor_ruby/puppet/util/errors.rb:64:in `exceptwrap'
/usr/share/ruby/vendor_ruby/puppet/parser/compiler.rb:383:in `evaluate_definitions'
/usr/share/ruby/vendor_ruby/puppet/parser/compiler.rb:404:in `block (2 levels) in evaluate_generators'
/usr/share/ruby/vendor_ruby/puppet/util/profiler/around_profiler.rb:58:in `profile'
/usr/share/ruby/vendor_ruby/puppet/util/profiler.rb:51:in `profile'
/usr/share/ruby/vendor_ruby/puppet/parser/compiler.rb:401:in `block in evaluate_generators'
/usr/share/ruby/vendor_ruby/puppet/parser/compiler.rb:398:in `loop'
/usr/share/ruby/vendor_ruby/puppet/parser/compiler.rb:398:in `evaluate_generators'
/usr/share/ruby/vendor_ruby/puppet/parser/compiler.rb:141:in `block (2 levels) in compile'
/usr/share/ruby/vendor_ruby/puppet/util/profiler/around_profiler.rb:58:in `profile'
/usr/share/ruby/vendor_ruby/puppet/util/profiler.rb:51:in `profile'
/usr/share/ruby/vendor_ruby/puppet/parser/compiler.rb:141:in `block in compile'
/usr/share/ruby/vendor_ruby/puppet/context.rb:64:in `override'
/usr/share/ruby/vendor_ruby/puppet.rb:246:in `override'
/usr/share/ruby/vendor_ruby/puppet/parser/compiler.rb:121:in `compile'
/usr/share/ruby/vendor_ruby/puppet/parser/compiler.rb:34:in `compile'
/usr/share/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:95:in `block (2 levels) in compile'
/usr/share/ruby/vendor_ruby/puppet/util/profiler/around_profiler.rb:58:in `profile'
/usr/share/ruby/vendor_ruby/puppet/util/profiler.rb:51:in `profile'
/usr/share/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:93:in `block in compile'
/usr/share/ruby/vendor_ruby/puppet/util.rb:161:in `block in benchmark'
/usr/share/ruby/benchmark.rb:296:in `realtime'
/usr/share/ruby/vendor_ruby/puppet/util.rb:160:in `benchmark'
/usr/share/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:92:in `compile'
/usr/share/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:52:in `find'
/usr/share/ruby/vendor_ruby/puppet/indirector/indirection.rb:201:in `find'
/usr/share/ruby/vendor_ruby/puppet/application/apply.rb:222:in `block in main'
/usr/share/ruby/vendor_ruby/puppet/context.rb:64:in `override'
/usr/share/ruby/vendor_ruby/puppet.rb:246:in `override'
/usr/share/ruby/vendor_ruby/puppet/application/apply.rb:198:in `main'
/usr/share/ruby/vendor_ruby/puppet/application/apply.rb:159:in `run_command'
/usr/share/ruby/vendor_ruby/puppet/application.rb:381:in `block (2 levels) in run'
/usr/share/ruby/vendor_ruby/puppet/application.rb:507:in `plugin_hook'
/usr/share/ruby/vendor_ruby/puppet/application.rb:381:in `block in run'
/usr/share/ruby/vendor_ruby/puppet/util.rb:496:in `exit_on_fail'
/usr/share/ruby/vendor_ruby/puppet/application.rb:381:in `run'
/usr/share/ruby/vendor_ruby/puppet/util/command_line.rb:146:in `run'
/usr/share/ruby/vendor_ruby/puppet/util/command_line.rb:92:in `execute'
/usr/bin/puppet:8:in `<main>'
class { 'dhcp':
default_lease_time => -1,
max_lease_time => -1,
}
error
isc dhcp supports indefinite timeout as -1
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Class[Dhcp]:
parameter 'default_lease_time' expects an Integer[1] value, got Integer[-1, -1]
parameter 'max_lease_time' expects an Integer[1] value, got Integer[-1, -1] (file: test.pp, line: 16, column: 3) on node test.local
isc dhcp supports indefinite leases by setting timeout to -1
Hi,
Just walking through a howto to setup Razor and as part of this process installed the puppetlabs-dhcp. This has a clean install of puppet and puppetmaster. Following the guide these are the commands I have run:
puppet module install puppetlabs-razor
puppet apply /etc/puppet/modules/razor/tests/init.pp --verbose
puppet module install zleslie/dhcp
puppet apply /etc/puppet/modules/dhcp/tests/init.pp --verbose
Running the dhcp tests init.pp file it complains that it could not find class concat::setup.
I think the forge module file needs to include a dependacy on concat::setup.
Peter
dhcp::pool should have a search domains parameter that sets the domain-search
option in the pool to a list of DNS domains. It should accept a single domain or an array.
Based on theforeman/puppet-dhcp@1ad54b3 and theforeman/puppet-dhcp@c961257.
The module should install isc-dhcp43-server
rather than dhcp42.
Based on theforeman/puppet-dhcp@8cd3778.
It's currently not possible to use this module to set up a DHCPv6 service
like in theforeman/puppet-dhcp@0bc528dd
Add parameters to the main dhcp
class to take an OMAPI secret key and name, then configure it in dhcpd.conf.
Based on theforeman/puppet-dhcp@f5c06c9 and theforeman/puppet-dhcp@7d49b00.
Add a dhcp::dhcp_class define that allows new client "class" blocks to be specified.
Based on theforeman/puppet-dhcp@b5f37fd and theforeman/puppet-dhcp@96e9d2b.
The dhcp
class should have pools and hosts parameters which use create_resources() to instantiate a number of DHCP pools and hosts defines, to help when using the module from Hiera or an ENC.
Based on theforeman/puppet-dhcp@447898e.
This module has no tests, so it's hard to merge PR's... here's some initial tests. they need expansion, but it's a starting point.
Hi,
Is there a plan to release a version of this module that is compatible with Puppet 8?
Currently in metadata.json the version requirements on Puppet are as following: ">= 7.0.0 < 8.0.0"
The concat and stdlib versions would also need to be incremented.
Thanks,
Maureen
class { "dhcp": [...other options...] nameservers => [], dnsdomain => [], }
dhcp does not run, because option domain-name-servers is empty (if you set nameservers to undef instead it will add the google nameservers)
generate a dhcpd.conf without "option domain-name-servers" and "option domain-name"
simple fix would be the following:
diff --git a/environments/production/modules/dhcp/templates/dhcpd.conf-header.erb b/environments/production/modules/dhcp/templates/dhcpd.conf-header.erb index 9f12b2a..bae1d36 100644 --- a/environments/production/modules/dhcp/templates/dhcpd.conf-header.erb +++ b/environments/production/modules/dhcp/templates/dhcpd.conf-header.erb @@ -13,8 +13,12 @@ log-facility <%= @logfacility %>; # ---------- # Options # ---------- +<% if @dnsdomain_real and !@dnsdomain_real.empty? -%> option domain-name "<%= @dnsdomain_real.first %>"; +<% end -%> +<% if @nameservers and @nameservers.is_a? Array and [email protected]? -%> option domain-name-servers <%= @nameservers.join(', ') %>; +<% end -%> option fqdn.no-client-update on; # set the "O" and "S" flag bits option fqdn.rcode2 255; option pxegrub code 150 = text;
however, properly allow to supply undef to those options would be better (but might break the usage for people who would like to have the google-servers as default). At least there need to be the possibility to not supply nameservers at all.
The pxeserver
parameter previously allowed hostnames to be specified but now only permits an IP address.
This was changed in 8d012a5
Use subclass
Subclass is not managed in this module
Allow use of "subclass" method
https://www.isc.org/wp-content/uploads/2017/08/dhcp41options.html
subclass "vendor-classes" "SUNW.Ultra-5_10" {
vendor-option-space SUNW;
option SUNW.root-path "/export/root/sparc";
}
Causes distributing IP-Addresses just to known clients but without fixed address.
Maybe code like this:
<% if @ip != '' -%> ip address "<%= @ip %>"; <% end -%>
class { 'dhcp':
dnsdomain => hiera('dhcp::dnsdomain'),
nameservers => hiera('dhcp::nameservers'),
ntpservers => hiera('dhcp::ntpservers'),
interfaces => hiera('dhcp::interfaces'),
# dnsupdatekey => "/etc/bind/bind.keys.d/${ddnskey}.key",
# require => Dns::Key[$ddnskey],
}
if ($ipam::dhcp_use_failover) {
class {'dhcp::failover':
role => hiera('dhcp::failover::role'),
peer_address => hiera('dhcp::failover::peer_address'),
}
Failover configuration fails do to "port" statement in template.
Failover configuration functioned properly when using centos 6. It appears changes between centos 6 and centos 7 regarding to dhcpd cause this module to when configuring failover on centos 7.
Commenting out the port statement in the templates/dhcpd.conf.failover.erb file resolves the issue.
Configure DHCP with failover module
bootp is disabled by default, as by
#126
The pull refer to https://linux.die.net/man/5/dhcpd.conf
But this chapter does not reflect anymore the current configuration, at least from Debian Stretch.
https://manpages.debian.org/testing/isc-dhcp-server/dhcpd.conf.5.en.html (ref: v4.3)
https://kb.isc.org/docs/isc-dhcp-41-manual-pages-dhcpdconf#configuring-failover
https://kb.isc.org/docs/isc-dhcp-44-manual-pages-dhcpdconf#configuring-failover
It should be sufficient to remove the bootp related line
Hi,
When I installed the this module I ran the test script and got the below output:
root@creator ~# puppet apply /etc/puppet/modules/dhcp/tests/init.pp --verbose
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/pe_version.rb
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/root_home.rb
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/puppet_vardir.rb
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/facter_dot_d.rb
Info: Loading facts in /etc/puppet/modules/concat/lib/facter/concat_basedir.rb
Warning: Config file /etc/puppet/hiera.yaml not found, using Hiera defaults
Error: Failed to parse template dhcp/dhcpd.pool.erb:
Filepath: /etc/puppet/modules/dhcp/templates/dhcpd.pool.erb
Line: 7
Detail: undefined method each' for "10.1.1.100":String at /etc/puppet/modules/dhcp/manifests/pool.pp:15 on node creator.mgnt.local Error: Failed to parse template dhcp/dhcpd.pool.erb: Filepath: /etc/puppet/modules/dhcp/templates/dhcpd.pool.erb Line: 7 Detail: undefined method
each' for "10.1.1.100":String
at /etc/puppet/modules/dhcp/manifests/pool.pp:15 on node creator.mgnt.local
While trying to work out what was wrong I realised that in the tests/init.pp file the test for the dhcpd.pool.erb file is passing a string and not an array:
dhcp::pool{ 'example.com':
network => '10.1.1.0',
mask => '255.255.255.0',
range => '10.1.1.100 10.1.1.200',
gateway => '10.1.1.1',
}
(Look at the range line) which means that in the erb template the string does not have an each method.
Also the DHCP module has a dependency on the Bind Module which means that the test fails because it cannot find the Bind module.
That's good work Guys, but I have a one question.
Are you going to support shared-network option in dhcp::pools module?
In my opinion this is very important feature especially when you have many small subnets in many VLANs
Cheers!
Pawel
The dhcp class should take parameters to configure ddns-domainname
and ddns-rev-domainname
.
Based on theforeman/puppet-dhcp@64234ae.
Hi all,
while trying to use this module in combination with pacemaker, I've discovered that if manage_service is false, then File[/etc/systemd/system/dhcpd.service] cannot "notify" the Service['dhcpd'].
Error: Failed to apply catalog: Could not find dependent Service[dhcpd] for File[/etc/systemd/system/dhcpd.service] at /opt/mdc/puppet/puppet_3rd_party/modules/dhcp/manifests/init.pp:181
FIX:
diff --git manifests/init.pp manifests/init.pp
index 23ac4f3..0d56344 100644
--- manifests/init.pp
+++ manifests/init.pp
@@ -183,7 +183,7 @@ class dhcp (
owner => 'root',
group => 'root',
mode => '0644',
- notify => Service[$servicename],
+ notify => $service_notify_real,
content => template('dhcp/dhcpd.service'),
}
} else {
In the end, thank you for the great job
Dan
The dhcp class should take an array parameter of additional files to include into the configuration using the include
directive.
Based on theforeman/puppet-dhcp@bd8c631.
default behaviour when following the README:
# puppet apply /etc/puppet/manifests/razor.pp --verbose --noop info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/root_home.rb info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/facter_dot_d.rb info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/puppet_vardir.rb Could not find class concat::setup for puppet-razor at /etc/puppet/modules/dhcp/manifests/init.pp:84 on node puppet-razor
After a 'puppet module install ripienaar-concat' the 'concat::setup' is correctly available.
The event handlers are currently only supported for dhcp::host
(see #216). These handlers can also exist globally in dhcpd.conf or in the pool definition dhcpd::pool
and dhcpd::pool6
.
I propose to replicate the PR and add 3 new optional parameters to the relevant classes:
on_commit
on_release
on_expiry
So two questions:
The "authoritative" statement in dhcpd.conf should be parameterised, so it can be disabled.
Based on theforeman/puppet-dhcp@e29568a, though that defaults to false/not authoritative.
Configure IPv4 range to be served from a Debian 9 system.
/etc/default/isc-dhcp-server contains an INTERFACES variable. Latest versions appear to have split that up between INTERFACESv4 and INTERFACESv6 so one may server each on differing interfaces as required.
Expected running servive, but systemd sees it as a failure.
Mar 11 20:46:22 desktop puppet-agent[16440]: (/Stage[main]/Dhcp/Service[isc-dhcp-server]) Mar 11 20:46:20 desktop systemd[1]: Stopping LSB: DHCP server...
Mar 11 20:46:22 desktop puppet-agent[16440]: (/Stage[main]/Dhcp/Service[isc-dhcp-server]) Mar 11 20:46:20 desktop isc-dhcp-server[16583]: Stopping ISC DHCPv4 server: dhcpd.
Mar 11 20:46:22 desktop puppet-agent[16440]: (/Stage[main]/Dhcp/Service[isc-dhcp-server]) Mar 11 20:46:20 desktop systemd[1]: Stopped LSB: DHCP server.
Mar 11 20:46:22 desktop puppet-agent[16440]: (/Stage[main]/Dhcp/Service[isc-dhcp-server]) Mar 11 20:46:20 desktop systemd[1]: Starting LSB: DHCP server...
Mar 11 20:46:22 desktop puppet-agent[16440]: (/Stage[main]/Dhcp/Service[isc-dhcp-server]) Mar 11 20:46:20 desktop isc-dhcp-server[16596]: DHCPv4 interfaces are no longer set by the INTERFACES variable in
Mar 11 20:46:22 desktop puppet-agent[16440]: (/Stage[main]/Dhcp/Service[isc-dhcp-server]) Mar 11 20:46:20 desktop isc-dhcp-server[16596]: /etc/default/isc-dhcp-server. Please use INTERFACESv4 instead.
Mar 11 20:46:22 desktop puppet-agent[16440]: (/Stage[main]/Dhcp/Service[isc-dhcp-server]) Mar 11 20:46:20 desktop isc-dhcp-server[16596]: Migrating automatically for now, but this will go away in the futu
Mar 11 20:46:22 desktop puppet-agent[16440]: (/Stage[main]/Dhcp/Service[isc-dhcp-server]) Mar 11 20:46:20 desktop isc-dhcp-server[16596]: Launching IPv4 server only.
Mar 11 20:46:22 desktop puppet-agent[16440]: (/Stage[main]/Dhcp/Service[isc-dhcp-server]) Mar 11 20:46:20 desktop dhcpd[16607]: Internet Systems Consortium DHCP Server 4.3.5
Mar 11 20:46:22 desktop puppet-agent[16440]: (/Stage[main]/Dhcp/Service[isc-dhcp-server]) Mar 11 20:46:20 desktop dhcpd[16607]: Copyright 2004-2016 Internet Systems Consortium.
Mar 11 20:46:22 desktop puppet-agent[16440]: (/Stage[main]/Dhcp/Service[isc-dhcp-server]) Mar 11 20:46:20 desktop dhcpd[16607]: All rights reserved.
Mar 11 20:46:22 desktop puppet-agent[16440]: (/Stage[main]/Dhcp/Service[isc-dhcp-server]) Mar 11 20:46:20 desktop dhcpd[16607]: For info, please visit https://www.isc.org/software/dhcp/
Mar 11 20:46:22 desktop puppet-agent[16440]: (/Stage[main]/Dhcp/Service[isc-dhcp-server]) Mar 11 20:46:20 desktop dhcpd[16607]: Wrote 0 deleted host decls to leases file.
Mar 11 20:46:22 desktop puppet-agent[16440]: (/Stage[main]/Dhcp/Service[isc-dhcp-server]) Mar 11 20:46:20 desktop dhcpd[16607]: Wrote 0 new dynamic host decls to leases file.
Mar 11 20:46:22 desktop puppet-agent[16440]: (/Stage[main]/Dhcp/Service[isc-dhcp-server]) Mar 11 20:46:20 desktop dhcpd[16607]: Wrote 29 leases to leases file.
Mar 11 20:46:22 desktop puppet-agent[16440]: (/Stage[main]/Dhcp/Service[isc-dhcp-server]) Mar 11 20:46:22 desktop isc-dhcp-server[16596]: Starting ISC DHCPv4 server: dhcpdcheck syslog for diagnostics. ...
Mar 11 20:46:22 desktop puppet-agent[16440]: (/Stage[main]/Dhcp/Service[isc-dhcp-server]) Mar 11 20:46:22 desktop isc-dhcp-server[16596]: failed!
Mar 11 20:46:22 desktop puppet-agent[16440]: (/Stage[main]/Dhcp/Service[isc-dhcp-server]) Mar 11 20:46:22 desktop systemd[1]: isc-dhcp-server.service: Control process exited, code=exited status=1
Mar 11 20:46:22 desktop puppet-agent[16440]: (/Stage[main]/Dhcp/Service[isc-dhcp-server]) Mar 11 20:46:22 desktop systemd[1]: Failed to start LSB: DHCP server.
Mar 11 20:46:22 desktop puppet-agent[16440]: (/Stage[main]/Dhcp/Service[isc-dhcp-server]) Mar 11 20:46:22 desktop systemd[1]: isc-dhcp-server.service: Unit entered failed state.
Mar 11 20:46:22 desktop puppet-agent[16440]: (/Stage[main]/Dhcp/Service[isc-dhcp-server]) Mar 11 20:46:22 desktop systemd[1]: isc-dhcp-server.service: Failed with result 'exit-code'.
Hi dear,
How to used pool an rule class for restrict mac address?
Currently the $ip
parameter in dhcp::host
is of type Stdlib::Compact::Ip_address
and so it is not possible to pass a hostname to the fixed-address
parameter. Since dhcpd also supports hostnames for the fixed-address
parameter, please add support for this too.
Hey,
why is there a huge gap between release version on https://forge.puppet.com/puppetlabs/dhcp (V0.4.0) and github release (1.0.0)
Based on theforeman/puppet-dhcp@c22f464.
one of our datatypes here is used in the nrpe module and puppetlabs/puppetlabs-stdlib#1005. As soon as the type in stdlib got released we can throw it out of this module and depend on stdlib.
It would be useful to add arbitrary arguments to the /etc/sysconfig/dhcpd file, but this file is not consumed by the systemd service. It seems on RHEL6 the system V init script would be left intact so that this file would be used.
On RHEL 7, use dhcp module and the interfaces should appear on the command line.
The interfaces are not specified on the command line.
The interfaces to be enumerated on the command line.
It would be useful to add arbitrary arguments to the /etc/sysconfig/dhcpd file.
This issue is related to documentation.
In the examples it shows the module interfacing with BIND to do allow dynamic DNS entries, e.g. require => Bind::Key['rndc-key'],
.
This example appears to reference a specific Bind
module, but as there is no official module and quite a number of competing BIND Puppet modules in Forge, is there a specific version it's intended to work with and, if so, should this not be referenced somewhere?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.