2021-07-30 09:15:36 +00:00
|
|
|
---
|
|
|
|
- name: Install knot
|
|
|
|
become: yes
|
|
|
|
apt:
|
|
|
|
update_cache: yes
|
|
|
|
pkg:
|
|
|
|
- knot
|
|
|
|
- knot-dnsutils
|
|
|
|
|
|
|
|
- name: Start knot
|
|
|
|
become: yes
|
|
|
|
service:
|
|
|
|
name: knot
|
|
|
|
state: started
|
|
|
|
enabled: yes
|
|
|
|
|
|
|
|
- name: Generate tsig
|
|
|
|
become: yes
|
2021-07-30 10:58:14 +00:00
|
|
|
shell:
|
2021-07-30 10:36:02 +00:00
|
|
|
cmd: "keymgr -t {{ key_name }} > /etc/knot/{{ key_name }}.key"
|
|
|
|
creates: "/etc/knot/{{ key_name }}.key"
|
|
|
|
run_once: True
|
2021-07-30 09:15:36 +00:00
|
|
|
|
|
|
|
- name: Fetch key
|
|
|
|
become: yes
|
|
|
|
ansible.builtin.slurp:
|
|
|
|
src: /etc/knot/{{ key_name }}.key
|
|
|
|
register: tsig_key
|
2021-07-30 10:36:02 +00:00
|
|
|
run_once: True
|
|
|
|
|
|
|
|
- name: Populate key to all host
|
2021-07-30 10:58:14 +00:00
|
|
|
set_fact:
|
|
|
|
tsig_key_content: "{{ tsig_key['content'] | b64decode }}"
|
2021-07-30 10:36:02 +00:00
|
|
|
run_once: True
|
|
|
|
with_items: "{{ play_hosts }}"
|
|
|
|
delegate_to: "{{ item }}"
|
2021-07-30 09:15:36 +00:00
|
|
|
|
|
|
|
- name: Deploy conf
|
|
|
|
become: yes
|
|
|
|
template:
|
|
|
|
src: knot.conf.j2
|
|
|
|
dest: /etc/knot/knot.conf
|
|
|
|
notify: reload knot
|