xaque208/puppet-unbound — pull request #9 by nicwaller (2013-08-19 00:42:06+00:00)
Title: Automatically install and configure DNS root hints

Here is a possible solution to issue https://github.com/xaque208/puppet-unbound/issues/7 about not having root hints available. I tried to copy the existing patterns as much as possible.

--

This patch relies on the use of `exec` to download the latest root hints from IANA. I think it's reasonable to assume that a DNS server has curl available and can contact the IANA webserver. The exec runs only if the hints file is missing, which is normally only on the first run.

Originally I was going to add extra parameters for customization, but I ended up keeping it simple after running into a couple problems:
- Unbound is chrooted, so it can't access files outside of the `/etc` directory. There isn't really any reason for somebody to customize the path to the root hints file.
- I was going to add a parameter that makes fetching root hints optional, but I wasn't sure how to handle the `requires` dependency correctly with the `cron` resource wrapped inside an `if {}` statement. Maybe the `before` metaparameter would work better?
- I was considering adding a `cron` resource that would update the root hints file, but I don't know of an elegant way to avoid the "thundering herd" problem that would result in a lot of simultaneous queries to the root hints servers if many servers were using this module.