adguard-home/tasks/disable-dns-bypass.yaml
author Luke Hoersten <luke@hoersten.org>
Sun, 04 Feb 2024 20:27:19 -0600
changeset 227 2e0366f2dcbe
parent 226 ce33bf94045f
permissions -rw-r--r--
Tons of updates to fix migration to new server.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
226
ce33bf94045f Added optional admin-local DNS bypass.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     1
---
ce33bf94045f Added optional admin-local DNS bypass.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     2
ce33bf94045f Added optional admin-local DNS bypass.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     3
- name: check if resolv.conf exists
ce33bf94045f Added optional admin-local DNS bypass.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     4
  stat: path="/etc/resolv.conf"
ce33bf94045f Added optional admin-local DNS bypass.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     5
  register: sym
ce33bf94045f Added optional admin-local DNS bypass.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     6
ce33bf94045f Added optional admin-local DNS bypass.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     7
- name: replace systemd-resolved conf stub
ce33bf94045f Added optional admin-local DNS bypass.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     8
  become: yes
ce33bf94045f Added optional admin-local DNS bypass.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     9
  copy:
ce33bf94045f Added optional admin-local DNS bypass.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    10
    remote_src: yes
ce33bf94045f Added optional admin-local DNS bypass.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    11
    src:  "/run/systemd/resolve/resolv.conf"
ce33bf94045f Added optional admin-local DNS bypass.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    12
    dest: "/etc/resolv.conf"
ce33bf94045f Added optional admin-local DNS bypass.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    13
  when: sym.stat.islnk is defined and sym.stat.islnk
ce33bf94045f Added optional admin-local DNS bypass.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    14
ce33bf94045f Added optional admin-local DNS bypass.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    15
- name: ensure nameserver is self
ce33bf94045f Added optional admin-local DNS bypass.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    16
  become: yes
ce33bf94045f Added optional admin-local DNS bypass.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    17
  lineinfile:
ce33bf94045f Added optional admin-local DNS bypass.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    18
    path: "/etc/resolv.conf"
ce33bf94045f Added optional admin-local DNS bypass.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    19
    regexp: "^nameserver"
ce33bf94045f Added optional admin-local DNS bypass.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    20
    line: "nameserver {{ansible_default_ipv4.address}}"
ce33bf94045f Added optional admin-local DNS bypass.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    21
ce33bf94045f Added optional admin-local DNS bypass.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    22
- name: disable systemd-resolved service
ce33bf94045f Added optional admin-local DNS bypass.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    23
  become: yes
ce33bf94045f Added optional admin-local DNS bypass.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    24
  systemd: name="systemd-resolved.service" enabled="no" state="stopped"