Updated client templating in adguard.
authorLuke Hoersten <luke@hoersten.org>
Sun, 28 Jun 2020 15:08:36 -0500
changeset 54 1ea4f1c7c675
parent 53 9e4f750f5d36
child 55 376bb71909a4
Updated client templating in adguard.
adguard-home/defaults/main.yaml
adguard-home/handlers/main.yaml
adguard-home/templates/AdGuardHome.yaml.j2
prometheus/server/tasks/main.yaml
--- a/adguard-home/defaults/main.yaml	Sun Jun 28 12:27:27 2020 -0500
+++ b/adguard-home/defaults/main.yaml	Sun Jun 28 15:08:36 2020 -0500
@@ -3,3 +3,10 @@
 adguard_home_arch: "arm"
 adguard_home_tar: "https://static.adguard.com/adguardhome/release/AdGuardHome_linux_{{adguard_home_arch}}.tar.gz"
 adguard_home_data_dir: "/var/lib/AdGuardHome"
+adguard_home_filters:
+  - url: https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt
+    name: AdGuard Simplified Domain Names filter
+    id: 1
+  - url: https://abp.oisd.nl
+    name: oisd.nl
+    id: 2
--- a/adguard-home/handlers/main.yaml	Sun Jun 28 12:27:27 2020 -0500
+++ b/adguard-home/handlers/main.yaml	Sun Jun 28 15:08:36 2020 -0500
@@ -2,4 +2,4 @@
 
 - name: restart adguard home
   become: yes
-  systemd: name="AdGuardHome.service" enabled="yes" daemon_reload="yes"
+  systemd: name="AdGuardHome.service" enabled="yes" daemon_reload="yes" state="restarted"
--- a/adguard-home/templates/AdGuardHome.yaml.j2	Sun Jun 28 12:27:27 2020 -0500
+++ b/adguard-home/templates/AdGuardHome.yaml.j2	Sun Jun 28 15:08:36 2020 -0500
@@ -69,18 +69,13 @@
   certificate_path: ""
   private_key_path: ""
 filters:
+{% for filter in adguard_home_filters %}
 - enabled: true
-  url: https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt
-  name: AdGuard Simplified Domain Names filter
-  id: 1
-- enabled: false
-  url: https://adaway.org/hosts.txt
-  name: AdAway
-  id: 2
-- enabled: false
-  url: https://www.malwaredomainlist.com/hostslist/hosts.txt
-  name: MalwareDomainList.com Hosts List
-  id: 4
+  url: {{filter.url}}
+  name: {{filter.name}}
+  id: {{filter.id}}
+{% else %}  []
+{% endfor %}
 whitelist_filters: []
 user_rules: []
 dhcp:
@@ -92,7 +87,22 @@
   range_end: ""
   lease_duration: 86400
   icmp_timeout_msec: 1000
-clients: []
+clients:
+{% for client in adguard_home_clients %}
+- name: {{client.name}}
+  tags: []
+  ids:
+  - {{client.ip}}
+  use_global_settings: {{not client.bypass}}
+  filtering_enabled: false
+  parental_enabled: false
+  safesearch_enabled: false
+  safebrowsing_enabled: false
+  use_global_blocked_services: {{not client.bypass}}
+  blocked_services: []
+  upstreams: []
+{% else %}  []
+{% endfor %}
 log_file: ""
 verbose: false
 schema_version: 6
--- a/prometheus/server/tasks/main.yaml	Sun Jun 28 12:27:27 2020 -0500
+++ b/prometheus/server/tasks/main.yaml	Sun Jun 28 15:08:36 2020 -0500
@@ -33,6 +33,7 @@
     ds_url: "http://localhost:9090"
     grafana_url: "http://localhost:3000"
     is_default: yes
+  changed_when: false
 
 - name: install grafana plugins
   become: yes