config-nameservers/roles/knot/tasks/main.yml
2021-07-30 12:36:02 +02:00

43 lines
834 B
YAML

---
- 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
ansible.builtin.shell:
cmd: "keymgr -t {{ key_name }} > /etc/knot/{{ key_name }}.key"
creates: "/etc/knot/{{ key_name }}.key"
run_once: True
- name: Fetch key
become: yes
ansible.builtin.slurp:
src: /etc/knot/{{ key_name }}.key
register: tsig_key
run_once: True
- name: Populate key to all host
set_facts:
tsig_key_content: {{ tsig_key['content'] | b64decode }}
run_once: True
with_items: "{{ play_hosts }}"
delegate_to: "{{ item }}"
- name: Deploy conf
become: yes
template:
src: knot.conf.j2
dest: /etc/knot/knot.conf
notify: reload knot