inkblot/puppet-bind

Need help using the module

Closed this issue · 5 comments

ege1 commented

Sorry for opening an issue for that but I couldn't find the needed information nor did I find a contact address.

I'm trying to manage the whole bind set-up using this module and hiera. I already tried with building a profile that uses created_resources to use the hiera data, but didn't get it done.

Nevertheless as far as I understood your documentation it should be possible to using hiera directly to set-up bind and configure zones and DNS records.

Can you give me a rough example in using your module with hiera including some basic records (and maybe even a wildcard record)?

Kind Regards,

Erik

Would it be possible for you to post the relevant parts of your code? I'd rather help debug that than produce a whole contrived example that may or may not illustrate a solution the problem you're experiencing.

ege1 commented

The main question is how to use your module using hiera.

What I tried now looks like:

bind::dnssec: false
profiles::dnsserver::dns_zones:
  example.com:
    zone_type: 'master'
    domain: 'example.com'
    allow_transfers:
      - '127.0.0.1'
      - '127.0.0.2'
    dynamic: true
    allow_updates:
      - '127.0.0.1'
profiles::dnsserver::dns_records:
    resource_record:
      name: 'www.example.com'
      record: 'www'
      ensure: 'present'
      type: 'A'
      data: '192.168.0.1'
      zone: 'example.com'

While the "profile::dnsserver" looks like:

class profiles::dnsserver {
  include bind
  $dns_zones = hiera_hash(profiles::dnsserver::dns_zones)
  create_resources(bind::zone, $dns_zones)
  $dns_records = hiera_hash(profiles::dnsserver::dns_records)
  create_resources(resource_record, $dns_records)

But I think there should be a way to directly use hiera to configure these values, at least as far as I understood your documentation.

My idea was to configure the whole name server including all records through hiera.

Kind Regards,

Erik

There will always need to be a place where the specific resources on your systems are declared in a manifest, and that can be abstracted out of the manifests and into hiera as you've done. The problem then is that the structure of data in hiera is dictated by the mechanics of how create_resources consumes it, but without the syntax hints that explicit resource declaration gives you and subject to implementation changes that might be difficult or impossible to compensate for backwards compatibility. In your case where you've written a profiles::dnsserver class that you're consuming internally, that's a trade-off for your own consideration. However, I would like to avoid sending module users on the wild goose chase of 'how is this hiera data supposed to look?'.

As far as your usage of the module is concerned, is this a feature request (which I am declining), or do you need help making your manifest work (which I am willing to provide)?

ege1 commented

I'm not sure I got you right. Does my usage make sence or could I just have "feeded" your module through hiera directly? Or do I have to build a class around your module?

I'm using for example the nginx module [https://forge.puppetlabs.com/jfryman/nginx], where my only line of code in the profiles class is "include nginx" and everything else is defined using hiera. Is this also possible with your module?

Is there a better way than using create_resources and still having all the "data" in hiera?

Thanks,

Erik

The module does not support that style of usage as-is. It requires an additional class like your profiles::dnsserver class in order to allow it. I intend to keep it that way.

I do not know of a better way than create_resources to do what you're trying to do.