From 702fc363394192d4448f3f171619fbfa05df38d1 Mon Sep 17 00:00:00 2001 From: Markus Katharina Brechtel Date: Tue, 21 Nov 2017 17:16:09 +0000 Subject: [PATCH] knot role --- handlers/main.yml | 7 +++++++ tasks/configure.yml | 7 +++++++ tasks/main.yml | 5 +++++ tasks/setup-Debian.yml | 7 +++++++ templates/knot.conf.j2 | 23 +++++++++++++++++++++++ 5 files changed, 49 insertions(+) create mode 100644 handlers/main.yml create mode 100644 tasks/configure.yml create mode 100644 tasks/main.yml create mode 100644 tasks/setup-Debian.yml create mode 100644 templates/knot.conf.j2 diff --git a/handlers/main.yml b/handlers/main.yml new file mode 100644 index 0000000..c94f0c7 --- /dev/null +++ b/handlers/main.yml @@ -0,0 +1,7 @@ +--- + +- name: reload knot + service: + name: knot + state: reloaded + listen: reload nameserver diff --git a/tasks/configure.yml b/tasks/configure.yml new file mode 100644 index 0000000..ec183c5 --- /dev/null +++ b/tasks/configure.yml @@ -0,0 +1,7 @@ +--- + +- name: knot configuration + template: + src: knot.conf.j2 + dest: /etc/knot/knot.conf + notify: reload knot diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..c7c74c4 --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,5 @@ +--- + +- include: setup-{{ansible_os_family}}.yml + +- include: configure.yml diff --git a/tasks/setup-Debian.yml b/tasks/setup-Debian.yml new file mode 100644 index 0000000..1767cdb --- /dev/null +++ b/tasks/setup-Debian.yml @@ -0,0 +1,7 @@ +--- + +- name: install debian packages + apt: + pkg: "{{item}}" + with_items: + - knot diff --git a/templates/knot.conf.j2 b/templates/knot.conf.j2 new file mode 100644 index 0000000..9eea887 --- /dev/null +++ b/templates/knot.conf.j2 @@ -0,0 +1,23 @@ +server: + listen: 0.0.0.0@53 + listen: ::@53 + +log: + - target: syslog + any: info + +template: +{% if nameserver_zonefile_directory is defined %} + - id: managed + storage: {{nameserver_zonefile_directory}} + semantic-checks: on +{% endif %} + +zone: +{% if nameserver_zones is defined %} +{% for zone in nameserver_zones %} + - domain: {{zone.domain}} + template: managed + file: {{zone.domain}}.zone +{% endfor %} +{% endif %}