adguard-home/tasks/main.yaml
changeset 122 cde9702e3bff
parent 55 376bb71909a4
child 174 431c6d5e5dd4
--- a/adguard-home/tasks/main.yaml	Wed Jul 08 15:46:28 2020 -0500
+++ b/adguard-home/tasks/main.yaml	Thu Jul 09 18:49:48 2020 -0500
@@ -44,17 +44,21 @@
   template: src="AdGuardHome.yaml.j2" dest="/etc/AdGuardHome/AdGuardHome.yaml"
   notify: restart adguard home
 
+- stat: "path=/etc/resolv.conf"
+  register: sym
+
+- name: replace systemd-resolved conf stub
+  become: yes
+  copy:
+    remote_src: yes
+    src:  "/run/systemd/resolve/resolv.conf"
+    dest: "/etc/resolv.conf"
+  when: sym.stat.islnk is defined and sym.stat.islnk
+
 - name: disable systemd-resolved service
   become: yes
   systemd: name="systemd-resolved.service" enabled="no" state="stopped"
 
-- name: replace systemd-resolved conf stub
-  become: yes
-  file:
-    src:  "/run/systemd/resolve/resolv.conf"
-    dest: "/etc/resolv.conf"
-    state: "link"
-
 - name: ensure adguard home is started
   become: yes
   systemd: name="AdGuardHome.service" enabled="yes" state="started"