diff --git a/manifests/init.pp b/manifests/init.pp index 0ba1b99..446f8aa 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -45,6 +45,21 @@ $service_ensure = 'running', $strict_order = true, $tftp_root = '/var/lib/tftpboot', + $addresses = {}, + $cnames = {}, + $dhcpboots = {}, + $dhcpmatches = {}, + $dhcpoptions = {}, + $dhcps = {}, + $dhcpstatics = {}, + $dnsrrs = {}, + $dnsservers = {}, + $domains = {}, + $hostrecords = {}, + $mxs = {}, + $ptrs = {}, + $svrs = {}, + $txts = {}, ) inherits dnsmasq::params { ## VALIDATION @@ -78,6 +93,11 @@ fail("Expect IP address for listen_address, got ${listen_address}") } + ## VALIDATE FOR DEFINES + validate_hash($addresses, $cnames, $dhcpboots, $dhcpmatches, $dhcpoptions, + $dhcps, $dhcpstatics, $dnsrrs, $dnsservers, $domains, + $hostrecords, $mxs, $ptrs, $svrs, $txts) + ## CLASS VARIABLES # Allow custom ::provider fact to override our provider, but only @@ -164,6 +184,52 @@ } } + if $addresses { + create_resources('dnsmasq::address', $addresses) + } + if $cnames { + create_resources('dnsmasq::cname', $cnames) + } + if $dhcpboots { + create_resources('dnsmasq::dhcpboot', $dhcpboots) + } + if $dhcpmatches { + create_resources('dnsmasq::dhcpmatch', $dhcpmatches) + } + if $dhcpoptions { + create_resources('dnsmasq::dhcpoption', $dhcpoptions) + } + if $dhcps { + create_resources('dnsmasq::dhcp', $dhcps) + } + if $dhcpstatics { + create_resources('dnsmasq::dhcpstatic', $dhcpstatics) + } + if $dnsrrs { + create_resources('dnsmasq::dnsrr', $dnsrrs) + } + if $dnsservers { + create_resources('dnsmasq::dnsserver', $dnsservers) + } + if $domains { + create_resources('dnsmasq::domain', $domains) + } + if $hostrecords { + create_resources('dnsmasq::hostrecord', $hostrecords) + } + if $mxs { + create_resources('dnsmasq::mx', $mxs) + } + if $ptrs { + create_resources('dnsmasq::ptr', $ptrs) + } + if $svrs { + create_resources('dnsmasq::svr', $svrs) + } + if $txts { + create_resources('dnsmasq::txt', $txts) + } + if ! $no_hosts { Host <||> { notify +> Service['dnsmasq'],