ansible/roles/unbound/tasks/main.yml
Yohaï-Eliel BERREBY 1dca5d2259 unbound: use handlers
Only restart unbound if the configuration
was actually updated.
2020-05-02 16:43:44 +02:00

41 lines
981 B
YAML

---
# This is used to let unbound bind to the right IP addresses.
- name: set dns_host_suffix (main)
set_fact:
dns_host_suffix: "{{ dns_host_suffix_main }}"
when: "'rdns_main' in group_names"
- name: set dns_host_suffix (backup)
set_fact:
dns_host_suffix: "{{ dns_host_suffix_backup }}"
when: "'rdns_backup' in group_names"
- name: install unbound
apt:
update_cache: true
name: unbound
state: present
register: unbound_install
- name: add unbound-control configuration
template:
src: unbound-control.conf.j2
dest: /etc/unbound/unbound.conf.d/unbound-control.conf
mode: 0644
notify: restart unbound
- name: setup main unbound config file
template:
src: unbound.conf.j2
dest: /etc/unbound/unbound.conf
mode: 0644
notify: restart unbound
- name: setup recursive DNS server config
template:
src: recursive.conf.j2
dest: /etc/unbound/unbound.conf.d/recursive.conf
mode: 0644
notify: restart unbound