adguard-home/tasks/main.yaml
author Luke Hoersten <luke@hoersten.org>
Sat, 10 Jul 2021 13:28:05 -0500
changeset 161 edc41ae39fb8
parent 122 cde9702e3bff
child 174 431c6d5e5dd4
permissions -rw-r--r--
Upgraded minecraft to 1.17.1

---

- name: unarchive adguard home
  become: yes
  unarchive:
    remote_src: yes
    src: "{{adguard_home_tar}}"
    dest: "/tmp/"
    creates: "/tmp/AdGuardHome/"
    owner: "root"
    group: "root"

- name: install adguard home binary
  become: yes
  copy:
    src: "/tmp/AdGuardHome/AdGuardHome"
    dest: "/usr/local/bin/"
    remote_src: yes
    owner: "root"
    group: "root"
    mode: "0755"
  notify: restart adguard home

- name: create dirs
  become: yes
  file:
    path: "{{item}}"
    state: "directory"
    owner: "root"
    group: "root"
    mode: "0755"
  loop:
    - "/etc/AdGuardHome"
    - "{{adguard_home_data_dir}}"
  notify: restart adguard home

- name: configure adguard home service
  become: yes
  template: src="AdGuardHome.service.j2" dest="/etc/systemd/system/AdGuardHome.service"
  notify: restart adguard home

- name: configure adguard home
  become: yes
  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: ensure adguard home is started
  become: yes
  systemd: name="AdGuardHome.service" enabled="yes" state="started"