summaryrefslogtreecommitdiffstats
path: root/distro/tests/ansible-roles/knot_dns
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 10:36:22 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 10:36:22 +0000
commitb88bb292821fd7742604ec4e280acebd9a049f62 (patch)
tree625e4e19e6619f7481e5a8103f876520950769f6 /distro/tests/ansible-roles/knot_dns
parentInitial commit. (diff)
downloadknot-b88bb292821fd7742604ec4e280acebd9a049f62.tar.xz
knot-b88bb292821fd7742604ec4e280acebd9a049f62.zip
Adding upstream version 3.0.5.upstream/3.0.5upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--distro/tests/ansible-roles/knot_dns/defaults/main.yaml5
-rw-r--r--distro/tests/ansible-roles/knot_dns/tasks/configure_zone.yaml24
-rw-r--r--distro/tests/ansible-roles/knot_dns/tasks/main.yaml40
-rw-r--r--distro/tests/ansible-roles/knot_dns/tasks/reload_knot.yaml15
-rw-r--r--distro/tests/ansible-roles/knot_dns/tasks/restart_knot.yaml15
-rw-r--r--distro/tests/ansible-roles/knot_dns/tasks/test_tcp.yaml5
-rw-r--r--distro/tests/ansible-roles/knot_dns/tasks/test_udp.yaml5
-rw-r--r--distro/tests/ansible-roles/knot_dns/vars/CentOS.yaml5
-rw-r--r--distro/tests/ansible-roles/knot_dns/vars/Debian.yaml5
-rw-r--r--distro/tests/ansible-roles/knot_dns/vars/Fedora.yaml5
-rw-r--r--distro/tests/ansible-roles/knot_dns/vars/Ubuntu.yaml5
-rw-r--r--distro/tests/ansible-roles/knot_dns/vars/openSUSE_Leap.yaml5
12 files changed, 134 insertions, 0 deletions
diff --git a/distro/tests/ansible-roles/knot_dns/defaults/main.yaml b/distro/tests/ansible-roles/knot_dns/defaults/main.yaml
new file mode 100644
index 0000000..0beb2ed
--- /dev/null
+++ b/distro/tests/ansible-roles/knot_dns/defaults/main.yaml
@@ -0,0 +1,5 @@
+---
+repos:
+ - knot-dns-latest
+update_packages: false
+distro: "{{ ansible_distribution | replace(' ', '_') }}"
diff --git a/distro/tests/ansible-roles/knot_dns/tasks/configure_zone.yaml b/distro/tests/ansible-roles/knot_dns/tasks/configure_zone.yaml
new file mode 100644
index 0000000..c6cce01
--- /dev/null
+++ b/distro/tests/ansible-roles/knot_dns/tasks/configure_zone.yaml
@@ -0,0 +1,24 @@
+---
+- name: create example.com zone
+ copy:
+ dest: /etc/knot/example.com.zone
+ mode: 0644
+ content: |
+ $ORIGIN example.com.
+ $TTL 3600
+ @ SOA dns1.example.com. hostmaster.example.com. (
+ 2010111213 ; serial
+ 6h ; refresh
+ 1h ; retry
+ 1w ; expire
+ 1d ) ; minimum
+ NS dns1
+ dns1 A 192.0.2.1
+
+- name: create config
+ blockinfile:
+ dest: /etc/knot/knot.conf
+ block: |
+ zone:
+ - domain: example.com
+ file: "/etc/knot/example.com.zone"
diff --git a/distro/tests/ansible-roles/knot_dns/tasks/main.yaml b/distro/tests/ansible-roles/knot_dns/tasks/main.yaml
new file mode 100644
index 0000000..ccaa671
--- /dev/null
+++ b/distro/tests/ansible-roles/knot_dns/tasks/main.yaml
@@ -0,0 +1,40 @@
+---
+- name: Include distribution specific vars
+ include_vars: "{{ distro }}.yaml"
+
+- name: Update all packages
+ package:
+ name: '*'
+ state: latest
+ when: update_packages|bool
+
+- name: Install packages
+ package:
+ name: "{{ packages }}"
+ state: latest
+
+- name: Always print package version at the end
+ block:
+
+ - include: configure_zone.yaml
+ - include: restart_knot.yaml
+
+ - include: test_udp.yaml
+ - include: test_tcp.yaml
+
+ - include: reload_knot.yaml
+
+ - include: test_udp.yaml
+ - include: test_tcp.yaml
+
+ always:
+
+ - name: Get installed package version
+ shell: "{{ show_package_version }}"
+ args:
+ warn: false
+ register: package_version
+
+ - name: Show installed version
+ debug:
+ var: package_version.stdout
diff --git a/distro/tests/ansible-roles/knot_dns/tasks/reload_knot.yaml b/distro/tests/ansible-roles/knot_dns/tasks/reload_knot.yaml
new file mode 100644
index 0000000..b7e681c
--- /dev/null
+++ b/distro/tests/ansible-roles/knot_dns/tasks/reload_knot.yaml
@@ -0,0 +1,15 @@
+---
+- block:
+ - name: Reload knot.service
+ service:
+ name: knot.service
+ state: reloaded
+ rescue:
+ - name: Get knot.service journal
+ shell: journalctl -u knot --since -20s
+ register: journal
+ - name: Print journal
+ debug:
+ var: journal
+ - name: Reload knot.service failed, see log above
+ shell: /bin/false
diff --git a/distro/tests/ansible-roles/knot_dns/tasks/restart_knot.yaml b/distro/tests/ansible-roles/knot_dns/tasks/restart_knot.yaml
new file mode 100644
index 0000000..08a3752
--- /dev/null
+++ b/distro/tests/ansible-roles/knot_dns/tasks/restart_knot.yaml
@@ -0,0 +1,15 @@
+---
+- block:
+ - name: Restart knot.service
+ service:
+ name: knot.service
+ state: restarted
+ rescue:
+ - name: Get knot.service journal
+ shell: journalctl -u knot --since -20s
+ register: journal
+ - name: Print journal
+ debug:
+ var: journal
+ - name: Restart knot.service failed, see log above
+ shell: /bin/false
diff --git a/distro/tests/ansible-roles/knot_dns/tasks/test_tcp.yaml b/distro/tests/ansible-roles/knot_dns/tasks/test_tcp.yaml
new file mode 100644
index 0000000..68dd8e9
--- /dev/null
+++ b/distro/tests/ansible-roles/knot_dns/tasks/test_tcp.yaml
@@ -0,0 +1,5 @@
+---
+- name: tcp_test resolve dns1.example.com
+ shell: kdig +tcp @127.0.0.1 dns1.example.com A
+ register: res
+ failed_when: '"192.0.2.1" not in res.stdout'
diff --git a/distro/tests/ansible-roles/knot_dns/tasks/test_udp.yaml b/distro/tests/ansible-roles/knot_dns/tasks/test_udp.yaml
new file mode 100644
index 0000000..6ab3245
--- /dev/null
+++ b/distro/tests/ansible-roles/knot_dns/tasks/test_udp.yaml
@@ -0,0 +1,5 @@
+---
+- name: udp_test resolve dns1.example.com
+ shell: kdig @127.0.0.1 dns1.example.com A
+ register: res
+ failed_when: '"192.0.2.1" not in res.stdout'
diff --git a/distro/tests/ansible-roles/knot_dns/vars/CentOS.yaml b/distro/tests/ansible-roles/knot_dns/vars/CentOS.yaml
new file mode 100644
index 0000000..90f7c9e
--- /dev/null
+++ b/distro/tests/ansible-roles/knot_dns/vars/CentOS.yaml
@@ -0,0 +1,5 @@
+---
+show_package_version: rpm -qi knot | grep '^Version'
+packages:
+ - knot
+ - knot-utils
diff --git a/distro/tests/ansible-roles/knot_dns/vars/Debian.yaml b/distro/tests/ansible-roles/knot_dns/vars/Debian.yaml
new file mode 100644
index 0000000..1b744d6
--- /dev/null
+++ b/distro/tests/ansible-roles/knot_dns/vars/Debian.yaml
@@ -0,0 +1,5 @@
+---
+show_package_version: dpkg -s knot | grep '^Version'
+packages:
+ - knot
+ - knot-dnsutils
diff --git a/distro/tests/ansible-roles/knot_dns/vars/Fedora.yaml b/distro/tests/ansible-roles/knot_dns/vars/Fedora.yaml
new file mode 100644
index 0000000..90f7c9e
--- /dev/null
+++ b/distro/tests/ansible-roles/knot_dns/vars/Fedora.yaml
@@ -0,0 +1,5 @@
+---
+show_package_version: rpm -qi knot | grep '^Version'
+packages:
+ - knot
+ - knot-utils
diff --git a/distro/tests/ansible-roles/knot_dns/vars/Ubuntu.yaml b/distro/tests/ansible-roles/knot_dns/vars/Ubuntu.yaml
new file mode 100644
index 0000000..1b744d6
--- /dev/null
+++ b/distro/tests/ansible-roles/knot_dns/vars/Ubuntu.yaml
@@ -0,0 +1,5 @@
+---
+show_package_version: dpkg -s knot | grep '^Version'
+packages:
+ - knot
+ - knot-dnsutils
diff --git a/distro/tests/ansible-roles/knot_dns/vars/openSUSE_Leap.yaml b/distro/tests/ansible-roles/knot_dns/vars/openSUSE_Leap.yaml
new file mode 100644
index 0000000..90f7c9e
--- /dev/null
+++ b/distro/tests/ansible-roles/knot_dns/vars/openSUSE_Leap.yaml
@@ -0,0 +1,5 @@
+---
+show_package_version: rpm -qi knot | grep '^Version'
+packages:
+ - knot
+ - knot-utils