Version information
This version is compatible with:
- Puppet Enterprise 3.2.x
- Puppet 3.x
- RedHat, CentOS, OracleLinux, Debian, Ubuntu, DragonFly, FreeBSD
Start using this module
Add this module to your Puppetfile:
mod 'lex-dnsmasq', '2.6.1'
Learn more about managing modules with a PuppetfileDocumentation
DESCRIPTION
I wrote this module in need of managing bunch of servers running dnsmasq.
It features some advanced features like:
- Basic dnsmasq management (service, installation)
- Cross-OS support (Debian, Ubuntu, RHEL, FreeBSD)
- Loads of options in basic config (ie TFTP) (If you need any additional option that does not supported in this module, just ping me)
- Support for DHCP configuration.
- Support for adding static DHCP records (MAC -> IP binding)
- Support for adding static DNS records (IP -> hostname binding)
- Support for DHCP options
- Support for dnsmasq tagging system
- And much more
DEPENDENCIES
- puppet >= 2.6
- puppetlabs/concat >= 1.0.0
- puppetlabs/stdlib
STATUS
TODO
- Unset as much as possible from base class by default
Basic class
Will install dnsmasq to act as DNS and TFTP (if specified) server
All possible options shown here
class { 'dnsmasq':
interface => 'lo',
listen_address => '192.168.39.1',
no_dhcp_interface => '192.168.49.1',
domain => 'int.lan',
port => '53',
expand_hosts => true,
enable_tftp => true,
tftp_root => '/var/lib/tftpboot',
dhcp_boot => 'pxelinux.0',
domain_needed => true,
bogus_priv => true,
no_negcache => true,
no_hosts => true,
resolv_file => '/etc/resolv.conf',
cache_size => 1000,
restart => true,
}
DHCP server configuration
Will add DHCP support to dnsmasq. This can be used multiple times to setup multiple DHCP servers. Parameter "paramset" is optional, this one makes use of tagging system in dnsmasq
dnsmasq::dhcp { 'dhcp':
paramset => 'hadoop0' #optional
dhcp_start => '192.168.1.100',
dhcp_end => '192.168.1.200',
netmask => '255.255.255.0',
lease_time => '24h'
}
Static DHCP record configuration
Will add static DHCP record to DHCP server with hostname. Please be aware that example-host will also be used as DNS name.
dnsmasq::dhcpstatic { 'example-host':
mac => 'DE:AD:BE:EF:CA:FE',
ip => '192.168.1.10',
}
Host record configuration
Will add static A, AAAA and PTR record
dnsmasq::hostrecord { "example-host-dns,example-host-dns.int.lan":
ip => '192.168.1.20',
}
A record configuration
Will add static A record, this record will always override upstream data
dnsmasq::address { "example-host-dns.int.lan":
ip => '192.168.1.20',
}
CNAME records
Will add canonical name record. Please note that dnsmasq cname is NOT regular cname and can be only for targets which are names from DHCP leases or /etc/hosts, so it's more like alias for hostname
dnsmasq::cname { "mail":
hostname => "post"
}
SRV records
Will add srv record which always overrides upstream data. Priority argument is optional.
dnsmasq::srv { "_ldap._tcp.example.com":
hostname => "ldap-server.example.com",
port => "389",
priority => "1",
}
MX records
Will create MX (mail eXchange) record which always override upstream data
dnsmasq::mx { "maildomain.com":
hostname => "mailserver.com",
preference => "50",
}
PTR records
Allows you to create PTR records for rDNS and DNS-SD.
dnsmasq::ptr { "_http._tcp.dns-sd-services":
value => '"New Employee Page._http._tcp.dns-sd-services"'
}
TXT records
Allows you to create TXT records
dnsmasq::txt { "_http._tcp.example.com":
value => "name=value,paper=A4"
}
(this actually should be done via array, will fix later)
DHCP option configuration
Will add dhcp option. Can be used for all types of options, ie:
- numeric ( dnsmasq::dhcpoption { '53': ... }
- ipv4-option ( dnsmasq::dhcpoption { 'option:router': ... }
- ipv6-option ( dnsmasq::dhcpoption { 'option6:dns-server': ... }
Can be used multiple times.
dnsmasq::dhcpoption { 'option:router':
content => '192.168.1.1',
paramtag => 'sometag', #optional
}
DHCP booting (PXE)
Allows you to setup different PXE servers in different subnets.
paramtag is optional, you can use this to specify subnet for bootserver,
using tag you previously specified in dnsmasq::dhcp
Can be used multiple times.
dnsmasq::dhcpboot { 'hadoop-pxe':
paramtag => 'hadoop0', #optional
file => 'pxelinux.0',
hostname => 'newoffice', #optional
bootserver => '192.168.39.1' #optional
}
Per-subnet domain
Allows you to specify different domain for specific subnets. Can be used multiple times.
dnsmasq::domain { 'guests.company.lan':
subnet => '192.168.196.0/24',
}
DNS server
Configure the DNS server to query external DNS servers
dnsmasq::dnsserver { 'dns':
ip => '192.168.1.1',
}
Or, to query specific zone
dnsmasq::dnsserver { 'forward-zone':
domain => "dumb.domain.tld",
ip => "192.168.39.1",
}
```puppet
### DNS-RR records
Allows dnsmasq to serve arbitrary records, for example:
```puppet
dnsmasq::dnsrr { 'example-sshfp':
domain => 'example.com',
type => '44',
rdata => '2:1:123456789abcdef67890123456789abcdef67890'
}
###Running in Docker containers When running in a Docker container, dnsmasq tries to drop root privileges. This causes the following error:
dnsmasq: setting capabilities failed: Operation not permitted
In this case you can use the run_as_user to provide the appropriate user to run as:
class { 'dnsmasq':
interface => 'lo',
listen_address => '192.168.39.1',
no_dhcp_interface => '192.168.49.1',
....
run_as_user => 'root',
}
2.6.1
- [DOCS] Add info about new ::dnsserver
2.6.0
This version's contibutors: bwalex @ github and funnymanva @ github.
- [FEATURE] add hook for resolvconf -u
- [FEATURE] dragonfly BSD support
- [FEATURE] dns-rr records support
- [FEATURE] add support for authoritative mode
- [FEATURE] support updating dnsmasq config without service restart
2.5.0
(NB: If you use dnsmasq::dnsserver class, read that changelog!) Thanks to Axel Bock ( flypenguin @ github ) for most of changes in this patch.
- [API] dnsmasq::dnsserver now require $domain variable for queueing subdomains
- [FEATURE] dnsmasq::dnsserver can now be used without domain (by default)
- [FEATURE] Ability to configure dnsmasq completely using a config_hash option
- [FEATURE] Save original config before replacing it with puppet-generated
- [FEATURE] Use a generic service name
- [FEATURE] Make service state configurable
- [FEATURE] Confdir is now optional
- [FEATURE] Most of variables in dnsserver::mx is now optional
- [FEATURE] Validate IP using stdlib
- [FIX] concat::setup call removed since it deprecated
- [FIX] Updated dependencies
2.4.0
Thanks to guimaluf @ github for that fixes/additions
- [FEATURE] dnsmasq::dhcpboot with less required parameters
- [FEATURE] dnsmasq::dhcpoption now supports dnsmasq tags
2.3.0
Thanks to Thomas Bétrancourt (rclsilver @ github) for that fixes/additions
- [FEATURE] dnsmasq 'server' option
- [FEATURE] dhcp-no-override parameter
- [FEATURE] no-dhcp-interface parameter
- [MISC] more readable template
- [FEATURE] notify dnsmasq service if $no_hosts parameter is false and when host entries are created
2.2.0
- [FEATURE] PTR records
- [FEATURE] TXT records
- [BUGFIX] proper variable calling in all templates
- [BUGFIX] fedora support fix
2.1.0
- [FEATURE] "cname" (sorta) records support
- [FEATURE] srv records support
- [FEATURE] mx records support
- [MISC] cosmetic changes in header of dnsmasq.conf, no more ugly newlines
- [BUGFIX] concat ordering fixed
2.0.0
(Please note: this release brings loads of changes and can break existing configs)
- [FEATURE] array can be used in 'interface =>' to specify several listen interfaces
- [FEATURE] listen_address added to specify IP instead of interfaces
- [FEATURE] array can be used in 'listen_address =>' to specify several listening IPs
- [FEATURE] dnsmasq::dhcpboot added to customize PXE booting for specific hosts/subnets
- [FEATURE] interface, listen_address and domain is now optional, undefined by default
- [FEATURE] dnsmasq::domain added to specify domain name for different subnets
- [FEATURE] tag and set options added to dnsmasq::dhcp and dnsmasq::dhcpboot
- [BUGFIX] several DHCP instances can be added now
- [BUGFIX] added forgotten concat dependency
- [BUGFIX] conf.d dir can now be used with system default
- [BUGFIX] Default dnsmasq conf.d directory can now be used on RHEL-based distros
1.1.2
- [FEATURE] DHCP server now supports netmask
- [API] dnsmasq::dhcp now requires netmask, check readme
1.1.1
- [FEATURE] Add resolv-file option
- [FEATURE] Add cache-size option
- [FEATURE] Add no-hosts option
- [FEATURE] Add dnsmasq.d config folder support
- [BUG] Wrong name in puppetforge modulefile
1.1.0
- [API] dnsmasq::dhcpstatic now uses $ip instead of $macip, update your configs
- [MISC] Fixed all style-errors in manifests
- [MISC] More adequate templates names
- [MISC] Warning about puppet management on top of dnsmasq.conf
- [FEATURE] Error message about unsupported systems
1.0.1
- [BUG] Hotfix for documentation, wrong class name in ::staticdhcp
1.0.0
- [INFO] Initial release
Dependencies
- puppetlabs/concat (>= 1.0.2)
- puppetlabs/stdlib (>= 4.2.0)