homeserver/roles/mgrote.dnsmasq_adblocker/tasks/blocklist.yml
mg fac0c68c5c Ersatz PiHole durch dnsmasq direkt (#298)
Co-authored-by: Michael Grote <michael.grote@posteo.de>
Reviewed-on: mg/ansible#298
Co-authored-by: mg <michael.grote@posteo.de>
Co-committed-by: mg <michael.grote@posteo.de>
2022-01-15 11:19:04 +01:00

19 lines
576 B
YAML

---
- name: download blocklist(s)
ansible.builtin.get_url:
url: "{{ item.url }}"
dest: "/etc/dnsmasq.d/blocklists/{{ item.name }}"
owner: "{{ dnsmasq_user }}"
group: "{{ dnsmasq_user_group }}"
loop: "{{ dnsmasq_blocklists }}"
when: item.state == "present"
notify: restart dnsmasq
register: download
- name: remove blocklist(s)
ansible.builtin.file:
path: "/etc/dnsmasq.d/blocklists/{{ item.name }}"
state: absent
loop: "{{ dnsmasq_blocklists }}"
when: item.state == "absent"
notify: restart dnsmasq