unbound: make sure unbound is loaded before the network is considered online
authorRalf Jung <post@ralfj.de>
Thu, 10 May 2018 07:18:52 +0000 (09:18 +0200)
committerRalf Jung <post@ralfj.de>
Thu, 10 May 2018 07:18:52 +0000 (09:18 +0200)
roles/postfix/files/unbound/unbound.service.override [new file with mode: 0644]
roles/postfix/tasks/unbound.yml

diff --git a/roles/postfix/files/unbound/unbound.service.override b/roles/postfix/files/unbound/unbound.service.override
new file mode 100644 (file)
index 0000000..7c58381
--- /dev/null
@@ -0,0 +1,2 @@
+[Unit]
+Before=network-online.target
index 34fbe81241d5fa813ea45c8394ee2b16fd1f7f34..0fe643cbfe22a7f85419c76d7c1dada8dab2d99b 100644 (file)
@@ -3,10 +3,20 @@
   apt: name=unbound state=latest
 # configure
 - name: configure unbound
   apt: name=unbound state=latest
 # configure
 - name: configure unbound
+  register: unbound_config
   copy:
     dest: /etc/unbound/unbound.conf.d/listen.conf
     src: files/unbound/listen.conf
   copy:
     dest: /etc/unbound/unbound.conf.d/listen.conf
     src: files/unbound/listen.conf
-  register: unbound_config
+- name: configure systemd (create dir)
+  file: path=/etc/systemd/system/unbound.service.d state=directory
+- name: configure systemd (tweak unbound)
+  register: unbound_systemd
+  copy:
+    dest: /etc/systemd/system/unbound.service.d/override.conf
+    src: files/unbound/unbound.service.override
+- name: reload systemd
+  when: unbound_systemd.changed
+  command: systemctl daemon-reload
 - name: restart unbound
   # not a handler to make sure it succeeds before we go touch system DNS
   when: unbound_config.changed
 - name: restart unbound
   # not a handler to make sure it succeeds before we go touch system DNS
   when: unbound_config.changed