GithubHelp home page GithubHelp logo

Comments (3)

pablokbs avatar pablokbs commented on July 21, 2024

Thanks, but that's not what I'm asking, I need to have only simple line on site.pp for each domain, I don't want to paste all that code there. That's why I'm creating a "define"

Also, even if I paste that at the beggining of the site.pp, I still need to add the zone to the zone hash, I mean, to add a domain I have to add it in two places, that's what I want to avoid.

from puppet-bind.

b4ldr avatar b4ldr commented on July 21, 2024

@pablokbs last one wouldn't work so i deleted it something like this should work though (untested and probably syntax spelling errors but you should get the idea)

site.pp

  $domains      => {
    example.com => { domain_ip => '10.0.0.1', spf => true, dkim => true, mx => "mx" },
    example.org => { domain_ip => '10.0.0.1', spf => true, dkim => true, mx => "mx" }
  }
  class {'::custom_bind':
    domains => $domains
  }

custom_bind/init.pp

class custom_bind ($domains) {
  include bind
  bind::server::conf { '/etc/named.conf':
    listen_on_addr    => [ 'any' ],
    listen_on_v6_addr => [ 'any' ],
    forwarders        => [ '8.8.8.8', '8.8.4.4' ],
    allow_query       => [ 'localnets' ],
    includes          => [ '/etc/named/zones.conf' ]
  }

  create_resources(custom_bind::domain, $domains)
  file {'/etc/named/zones.conf':
    ensure => present,
    content  => template('bind/zones.conf.erb'),
  }
}

custom_bind/domain.pp

define custom_bind::domain ($domain_ip, $spf, $dkim, $mx) {
  bind::server::file { "${name}.zone":
    zone_type => "master",
    content  => template('bind/zone.erb'),
  }
}

zone.conf.erb

<% @domains.each_key do |zone| -%>
zone <%= zone %> {
  type master;
  file <%= zone %>;
};

from puppet-bind.

pablokbs avatar pablokbs commented on July 21, 2024

I had to make some adjustments but it worked perfectly, thank you very much.

from puppet-bind.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.