34 lines
950 B
YAML
34 lines
950 B
YAML
---
|
|
- block:
|
|
- name: create zone file
|
|
shell: cp /usr/share/doc/knot/samples/example.com.zone /var/lib/knot/example.com.zone
|
|
|
|
- name: configure knot to serve example.com zone
|
|
lineinfile:
|
|
path: /etc/knot/knot.conf
|
|
regexp: '^#? - domain: example.com$'
|
|
state: present
|
|
line: ' - domain: example.com'
|
|
|
|
- name: start knot.service
|
|
service:
|
|
name: knot.service
|
|
state: restarted
|
|
|
|
- name: check if query is answered
|
|
shell: dig @127.0.0.1 example.com
|
|
register: res
|
|
failed_when: "'NOERROR' not in res.stdout"
|
|
|
|
- name: check query for non-existent zone is refused
|
|
shell: dig @127.0.0.1 example2.com
|
|
register: res
|
|
failed_when: "'REFUSED' not in res.stdout"
|
|
|
|
rescue:
|
|
- set_fact:
|
|
test_basic_zone_failed: true
|
|
always:
|
|
- name: collect journal
|
|
shell: journalctl --since -10m > {{ artifacts }}/test_basic_zone_journal.log
|