algo/roles/dns_adblocking/tasks/main.yml
2016-08-20 16:22:14 +03:00

33 lines
848 B
YAML

- name: Gather Facts
setup:
- name: Dnsmasq installed
apt: name=dnsmasq state=latest
- name: Dnsmasq profile for apparmor configured
template: src=usr.sbin.dnsmasq.j2 dest=/etc/apparmor.d/usr.sbin.dnsmasq owner=root group=root mode=0600
notify:
- restart dnsmasq
- name: Enforce the dnsmasq AppArmor policy
shell: aa-enforce usr.sbin.dnsmasq
- name: Dnsmasq configured
template: src=dnsmasq.conf.j2 dest=/etc/dnsmasq.conf
notify:
- restart dnsmasq
- name: Adblock script created
template: src=adblock.sh dest=/opt/adblock.sh owner=root group=root mode=0755
- name: Adblock script added to cron
cron: name="Adblock hosts update" minute="10" hour="2" job="/opt/adblock.sh"
- name: Update adblock hosts
shell: >
/opt/adblock.sh
- name: Dnsmasq enabled and started
service: name=dnsmasq state=started enabled=yes