From 865c58bd4c58acc0377836abf32c9fab1493022e Mon Sep 17 00:00:00 2001 From: Markus Hauschild Date: Sat, 31 Jul 2021 08:57:27 +0200 Subject: [PATCH] dns_*: initialize sqlite database --- roles/dns_extern/tasks/main.yml | 10 ++++++++++ roles/dns_intern/tasks/main.yml | 11 +++++++++++ 2 files changed, 21 insertions(+) diff --git a/roles/dns_extern/tasks/main.yml b/roles/dns_extern/tasks/main.yml index cb59ced..c93d2ed 100644 --- a/roles/dns_extern/tasks/main.yml +++ b/roles/dns_extern/tasks/main.yml @@ -5,11 +5,21 @@ name: - pdns-server - pdns-backend-sqlite3 + - sqlite3 - name: Configure powerdns template: src=pdns.conf.j2 dest=/etc/powerdns/pdns.conf notify: Restart powerdns +- name: Initialize database + command: + cmd: > + sqlite3 -init /usr/share/doc/pdns-backend-sqlite3/schema.sqlite3.sql + /var/lib/powerdns/powerdns.sqlite3 + creates: /var/lib/powerdns/powerdns.sqlite3 + become: true + become_user: pdns + - name: Copy update policy script copy: src=updatepolicy.lua dest=/etc/powerdns/updatepolicy.lua notify: Restart powerdns diff --git a/roles/dns_intern/tasks/main.yml b/roles/dns_intern/tasks/main.yml index d6618fa..84fae77 100644 --- a/roles/dns_intern/tasks/main.yml +++ b/roles/dns_intern/tasks/main.yml @@ -4,8 +4,10 @@ apt: name: - dnsdist + - pdns-backend-sqlite3 - pdns-server - pdns-recursor + - sqlite3 - name: Create zone directory file: path=/etc/powerdns/bind/ state=directory @@ -20,6 +22,15 @@ - bind/23.172.in-addr.arpa.zone - bind/binary.kitchen.zone +- name: Initialize database + command: + cmd: > + sqlite3 -init /usr/share/doc/pdns-backend-sqlite3/schema.sqlite3.sql + /var/lib/powerdns/pdns.sqlite3 + creates: /var/lib/powerdns/pdns.sqlite3 + become: true + become_user: pdns + # TODO # Initialize zone users.binary.kitchen using pdnsutil or SQL on the master