Skip to content

Commit 1335896

Browse files
committed
Unbound: forward queries to NextDNS over DoT
Also: setup Unbound on Debian containers
1 parent 37ec741 commit 1335896

4 files changed

Lines changed: 37 additions & 25 deletions

File tree

files/etc/unbound/unbound.conf

Lines changed: 0 additions & 6 deletions
This file was deleted.

tasks/common.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,22 @@
112112
copy:
113113
content: ""
114114
dest: "/etc/motd"
115+
116+
- name: Install unbound
117+
when: ansible_distribution == "Debian"
118+
apt:
119+
name: unbound
120+
121+
- name: Add Unbound config
122+
when: ansible_distribution == "Debian"
123+
template:
124+
src: "etc/unbound/unbound.conf.j2"
125+
dest: "/etc/unbound/unbound.conf"
126+
notify: unbound restart
127+
128+
- name: Set DNS resolver to Unbound in DHCP config
129+
when: ansible_distribution == "Debian"
130+
lineinfile:
131+
dest: /etc/dhcp/dhclient.conf
132+
regexp: "^prepend domain-name-servers"
133+
line: "prepend domain-name-servers 127.0.0.1;"

tasks/host.yml

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,25 +33,6 @@
3333
- fail2ban
3434
- haveged
3535

36-
- name: Install unbound
37-
when: ansible_distribution == "Debian"
38-
apt:
39-
name: unbound
40-
41-
- name: Add Unbound config
42-
when: ansible_distribution == "Debian"
43-
copy:
44-
src: "etc/unbound/unbound.conf"
45-
dest: "/etc/unbound/"
46-
notify: unbound restart
47-
48-
- name: Set DNS resolver to Unbound in DHCP config
49-
when: ansible_distribution == "Debian"
50-
lineinfile:
51-
dest: /etc/dhcp/dhclient.conf
52-
regexp: "^prepend domain-name-servers"
53-
line: "prepend domain-name-servers 127.0.0.1;"
54-
5536
- name: Set swappiness to 5
5637
sysctl:
5738
name: vm.swappiness
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
include: "/etc/unbound/unbound.conf.d/*.conf"
2+
3+
hide-identity: yes
4+
hide-version: yes
5+
use-caps-for-id: yes
6+
prefetch: yes
7+
8+
{% if ansible_distribution_release == 'buster' %}
9+
tls-cert-bundle: /etc/ssl/certs/ca-certificates.crt
10+
11+
forward-zone:
12+
name: "."
13+
forward-tls-upstream: yes
14+
forward-addr: 2a07:a8c0::#{{ inventory_hostname }}-{{ nextdns_config_name }}.dns1.nextdns.io
15+
forward-addr: 2a07:a8c1::#{{ inventory_hostname }}-{{ nextdns_config_name }}.dns2.nextdns.io
16+
forward-addr: 45.90.28.0#{{ inventory_hostname }}-{{ nextdns_config_name }}.dns1.nextdns.io
17+
forward-addr: 45.90.30.0#{{ inventory_hostname }}-{{ nextdns_config_name }}.dns2.nextdns.io
18+
{% endif %}

0 commit comments

Comments
 (0)