author | Luke Hoersten <luke@hoersten.org> |
Mon, 03 Apr 2023 13:20:18 -0500 | |
changeset 211 | 9e2b2cc6ccf1 |
parent 204 | fd38efd8f637 |
child 226 | ce33bf94045f |
permissions | -rw-r--r-- |
50 | 1 |
--- |
2 |
||
3 |
- name: unarchive adguard home |
|
4 |
become: yes |
|
5 |
unarchive: |
|
6 |
remote_src: yes |
|
7 |
src: "{{adguard_home_tar}}" |
|
8 |
dest: "/tmp/" |
|
9 |
creates: "/tmp/AdGuardHome/" |
|
10 |
owner: "root" |
|
11 |
group: "root" |
|
12 |
||
13 |
- name: install adguard home binary |
|
14 |
become: yes |
|
15 |
copy: |
|
16 |
src: "/tmp/AdGuardHome/AdGuardHome" |
|
17 |
dest: "/usr/local/bin/" |
|
18 |
remote_src: yes |
|
19 |
owner: "root" |
|
20 |
group: "root" |
|
21 |
mode: "0755" |
|
22 |
notify: restart adguard home |
|
23 |
||
24 |
- name: create dirs |
|
25 |
become: yes |
|
26 |
file: |
|
27 |
path: "{{item}}" |
|
28 |
state: "directory" |
|
29 |
owner: "root" |
|
30 |
group: "root" |
|
31 |
mode: "0755" |
|
32 |
loop: |
|
33 |
- "/etc/AdGuardHome" |
|
34 |
- "{{adguard_home_data_dir}}" |
|
35 |
notify: restart adguard home |
|
36 |
||
37 |
- name: configure adguard home service |
|
38 |
become: yes |
|
39 |
template: src="AdGuardHome.service.j2" dest="/etc/systemd/system/AdGuardHome.service" |
|
40 |
notify: restart adguard home |
|
41 |
||
42 |
- name: configure adguard home |
|
43 |
become: yes |
|
44 |
template: src="AdGuardHome.yaml.j2" dest="/etc/AdGuardHome/AdGuardHome.yaml" |
|
45 |
notify: restart adguard home |
|
46 |
||
174 | 47 |
- name: check if resolv.conf exists |
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 |
|
204 | 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 |
||
53
9e4f750f5d36
Disable systemd-resolved to not conflict with adguard home.
Luke Hoersten <luke@hoersten.org>
parents:
50
diff
changeset
|
66 |
- name: disable systemd-resolved service |
9e4f750f5d36
Disable systemd-resolved to not conflict with adguard home.
Luke Hoersten <luke@hoersten.org>
parents:
50
diff
changeset
|
67 |
become: yes |
9e4f750f5d36
Disable systemd-resolved to not conflict with adguard home.
Luke Hoersten <luke@hoersten.org>
parents:
50
diff
changeset
|
68 |
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
|
69 |
|
50 | 70 |
- name: ensure adguard home is started |
71 |
become: yes |
|
72 |
systemd: name="AdGuardHome.service" enabled="yes" state="started" |