adguard-home/tasks/main.yaml
changeset 226 ce33bf94045f
parent 204 fd38efd8f637
equal deleted inserted replaced
225:6936497313ac 226:ce33bf94045f
    42 - name: configure adguard home
    42 - name: configure adguard home
    43   become: yes
    43   become: yes
    44   template: src="AdGuardHome.yaml.j2" dest="/etc/AdGuardHome/AdGuardHome.yaml"
    44   template: src="AdGuardHome.yaml.j2" dest="/etc/AdGuardHome/AdGuardHome.yaml"
    45   notify: restart adguard home
    45   notify: restart adguard home
    46 
    46 
    47 - name: check if resolv.conf exists
    47 - include: enable-dns-bypass.yaml
    48   stat: path="/etc/resolv.conf"
    48   when: adguard_dns_bypass
    49   register: sym
       
    50 
    49 
    51 - name: replace systemd-resolved conf stub
    50 - include: disable-dns-bypass.yaml
    52   become: yes
    51   when: not adguard_dns_bypass
    53   copy:
       
    54     remote_src: yes
       
    55     src:  "/run/systemd/resolve/resolv.conf"
       
    56     dest: "/etc/resolv.conf"
       
    57   when: sym.stat.islnk is defined and sym.stat.islnk
       
    58 
       
    59 - name: ensure nameserver is self
       
    60   become: yes
       
    61   lineinfile:
       
    62     path: "/etc/resolv.conf"
       
    63     regexp: "^nameserver"
       
    64     line: "nameserver {{ansible_default_ipv4.address}}"
       
    65 
       
    66 - name: disable systemd-resolved service
       
    67   become: yes
       
    68   systemd: name="systemd-resolved.service" enabled="no" state="stopped"
       
    69 
    52 
    70 - name: ensure adguard home is started
    53 - name: ensure adguard home is started
    71   become: yes
    54   become: yes
    72   systemd: name="AdGuardHome.service" enabled="yes" state="started"
    55   systemd: name="AdGuardHome.service" enabled="yes" state="started"