adguard-home/tasks/main.yaml
author Luke Hoersten <luke@hoersten.org>
Mon, 08 Aug 2022 16:12:44 -0500
changeset 182 b4ce6f1f15b7
parent 174 431c6d5e5dd4
child 204 fd38efd8f637
permissions -rw-r--r--
Version updates
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
50
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     1
---
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     2
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     3
- name: unarchive adguard home
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     4
  become: yes
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     5
  unarchive:
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     6
    remote_src: yes
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     7
    src: "{{adguard_home_tar}}"
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     8
    dest: "/tmp/"
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     9
    creates: "/tmp/AdGuardHome/"
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    10
    owner: "root"
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    11
    group: "root"
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    12
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    13
- name: install adguard home binary
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    14
  become: yes
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    15
  copy:
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    16
    src: "/tmp/AdGuardHome/AdGuardHome"
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    17
    dest: "/usr/local/bin/"
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    18
    remote_src: yes
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    19
    owner: "root"
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    20
    group: "root"
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    21
    mode: "0755"
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    22
  notify: restart adguard home
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    23
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    24
- name: create dirs
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    25
  become: yes
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    26
  file:
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    27
    path: "{{item}}"
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    28
    state: "directory"
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    29
    owner: "root"
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    30
    group: "root"
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    31
    mode: "0755"
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    32
  loop:
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    33
    - "/etc/AdGuardHome"
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    34
    - "{{adguard_home_data_dir}}"
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    35
  notify: restart adguard home
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    36
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    37
- name: configure adguard home service
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    38
  become: yes
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    39
  template: src="AdGuardHome.service.j2" dest="/etc/systemd/system/AdGuardHome.service"
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    40
  notify: restart adguard home
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    41
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    42
- name: configure adguard home
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    43
  become: yes
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    44
  template: src="AdGuardHome.yaml.j2" dest="/etc/AdGuardHome/AdGuardHome.yaml"
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    45
  notify: restart adguard home
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    46
174
431c6d5e5dd4 Lots of updates.
Luke Hoersten <luke@hoersten.org>
parents: 122
diff changeset
    47
- name: check if resolv.conf exists
431c6d5e5dd4 Lots of updates.
Luke Hoersten <luke@hoersten.org>
parents: 122
diff changeset
    48
  stat: path="/etc/resolv.conf"
122
cde9702e3bff Fixed resolv.conf in adguard role.
Luke Hoersten <luke@hoersten.org>
parents: 55
diff changeset
    49
  register: sym
cde9702e3bff Fixed resolv.conf in adguard role.
Luke Hoersten <luke@hoersten.org>
parents: 55
diff changeset
    50
cde9702e3bff Fixed resolv.conf in adguard role.
Luke Hoersten <luke@hoersten.org>
parents: 55
diff changeset
    51
- name: replace systemd-resolved conf stub
cde9702e3bff Fixed resolv.conf in adguard role.
Luke Hoersten <luke@hoersten.org>
parents: 55
diff changeset
    52
  become: yes
cde9702e3bff Fixed resolv.conf in adguard role.
Luke Hoersten <luke@hoersten.org>
parents: 55
diff changeset
    53
  copy:
cde9702e3bff Fixed resolv.conf in adguard role.
Luke Hoersten <luke@hoersten.org>
parents: 55
diff changeset
    54
    remote_src: yes
cde9702e3bff Fixed resolv.conf in adguard role.
Luke Hoersten <luke@hoersten.org>
parents: 55
diff changeset
    55
    src:  "/run/systemd/resolve/resolv.conf"
cde9702e3bff Fixed resolv.conf in adguard role.
Luke Hoersten <luke@hoersten.org>
parents: 55
diff changeset
    56
    dest: "/etc/resolv.conf"
cde9702e3bff Fixed resolv.conf in adguard role.
Luke Hoersten <luke@hoersten.org>
parents: 55
diff changeset
    57
  when: sym.stat.islnk is defined and sym.stat.islnk
cde9702e3bff Fixed resolv.conf in adguard role.
Luke Hoersten <luke@hoersten.org>
parents: 55
diff changeset
    58
53
9e4f750f5d36 Disable systemd-resolved to not conflict with adguard home.
Luke Hoersten <luke@hoersten.org>
parents: 50
diff changeset
    59
- name: disable systemd-resolved service
9e4f750f5d36 Disable systemd-resolved to not conflict with adguard home.
Luke Hoersten <luke@hoersten.org>
parents: 50
diff changeset
    60
  become: yes
9e4f750f5d36 Disable systemd-resolved to not conflict with adguard home.
Luke Hoersten <luke@hoersten.org>
parents: 50
diff changeset
    61
  systemd: name="systemd-resolved.service" enabled="no" state="stopped"
9e4f750f5d36 Disable systemd-resolved to not conflict with adguard home.
Luke Hoersten <luke@hoersten.org>
parents: 50
diff changeset
    62
50
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    63
- name: ensure adguard home is started
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    64
  become: yes
15edca738a31 Added AdGuard Home role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    65
  systemd: name="AdGuardHome.service" enabled="yes" state="started"