Browse Source

master slave server

master
parent
commit
16daf05eae
1 changed files with 51 additions and 0 deletions
  1. +51
    -0
      templates/knot.conf.j2

+ 51
- 0
templates/knot.conf.j2 View File

@@ -1,23 +1,74 @@
server: server:
listen: 0.0.0.0@53 listen: 0.0.0.0@53
listen: ::@53 listen: ::@53
user: knot:knot


log: log:
- target: syslog - target: syslog
any: info any: info


template: template:
- id: slave
storage: /var/lib/knot/slave
{% if nameserver_zonefile_directory is defined %} {% if nameserver_zonefile_directory is defined %}
- id: managed - id: managed
storage: {{nameserver_zonefile_directory}} storage: {{nameserver_zonefile_directory}}
semantic-checks: on semantic-checks: on
{% endif %} {% endif %}


remote:
{% if nameserver_zones is defined %}
{% for zone in nameserver_zones %}
{% if zone.type|default('managed') == 'slave' %}
- id: {{zone.domain}}/master
address: {{zone.master.ip}}
{% endif %}
{% if zone.slaves is defined %}
{% for slave in zone.slaves %}
- id: {{zone.domain}}/slave/{{slave.name}}
address: {{slave.ip}}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}

acl:
{% if nameserver_zones is defined %}
{% for zone in nameserver_zones %}
{% if zone.type|default('managed') == 'slave' %}
- id: {{zone.domain}}/master/allow_notify
address: {{zone.master.ip}}
action: notify
{% endif %}
{% if zone.slaves is defined %}
{% for slave in zone.slaves %}
- id: {{zone.domain}}/slave/{{slave.name}}/allow_transfer
address: {{slave.ip}}
action: transfer
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}

zone: zone:
{% if nameserver_zones is defined %} {% if nameserver_zones is defined %}
{% for zone in nameserver_zones %} {% for zone in nameserver_zones %}
{% if zone.type|default('managed') != 'slave' %}
- domain: {{zone.domain}} - domain: {{zone.domain}}
template: managed template: managed
file: {{zone.domain}}.zone file: {{zone.domain}}.zone
{% elif zone.type|default('managed') == 'slave' %}
- domain: {{zone.domain}}
template: slave
master: {{zone.domain}}/master
file: {{zone.domain}}.zone
acl: {{zone.domain}}/master/allow_notify
{% endif %}
{% if zone.slaves is defined %}
{% for slave in zone.slaves %}
notify: {{zone.domain}}/slave/{{slave.name}}
acl: {{zone.domain}}/slave/{{slave.name}}/allow_transfer
{% endfor %}
{% endif %}
{% endfor %} {% endfor %}
{% endif %} {% endif %}

Loading…
Cancel
Save