update roothints monthly

This commit is contained in:
Pig Monkey 2019-09-11 18:54:08 -07:00
parent fc80e7ce2e
commit f8893fe292
5 changed files with 42 additions and 0 deletions

View file

@ -143,6 +143,7 @@ localtime:
unbound:
tls: True
roothints_update: trusted
nameservers:
- 1.1.1.1@853#cloudflare-dns.com # Cloudflare
- 9.9.9.9@853#dns.quad9.net # Quad9

View file

@ -0,0 +1,6 @@
[Unit]
Description=Unbound Root Hints Update Service
After=network.target
[Service]
ExecStart=/usr/bin/curl -sS -o /etc/unbound/root.hints https://www.internic.net/domain/named.cache

View file

@ -0,0 +1,11 @@
[Unit]
Description=Unbound Root Hints Update Timer
[Timer]
OnCalendar=monthly
Persistent=true
RandomizedDelaySec=3600
Unit=roothints.service
[Install]
WantedBy=timers.target

View file

@ -1,3 +1,7 @@
---
- name: restart unbound
service: name=unbound state=restarted
- name: restart roothints
service: name=roothints.timer state=restarted
when: unbound.roothints_update == "all"

View file

@ -40,3 +40,23 @@
lineinfile: dest=/etc/resolvconf.conf
state=present
line="name_servers=127.0.0.1"
- name: Push Unbound root hits update service file
copy:
src: roothints.service
dest: /etc/systemd/system/roothints.service
notify:
- reload systemd config
- name: Push Unbound root hits update timer file
copy:
src: roothints.timer
dest: /etc/systemd/system/roothints.timer
notify:
- reload systemd config
- restart roothints
- include_tasks: roles/nmtrust/tasks/unit.yml
vars:
unit: roothints.timer
run_on: "{{ unbound.roothints_update }}"