From 3d9b462c45adfcd8750ab4298f68294fc3aa4bcf Mon Sep 17 00:00:00 2001 From: vincent Date: Sat, 9 Apr 2022 08:47:48 +0200 Subject: [PATCH] manage several local resolver --- defaults/main.yml | 17 ++++++++++------- templates/02-localresolver.conf.j2 | 6 +++--- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 7a5d914..8a92121 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -17,13 +17,16 @@ pihole_port: - "67:67/udp" - "{{pihole_http_port}}:80/tcp" -pihole_forwarder1: '1.1.1.1' -pihole_forwarder2: '80.67.169.40' +pihole_forwarder1: "1.1.1.1" +pihole_forwarder2: "80.67.169.40" pihole_timezone: "Europe/Paris" -pihole_local_domain: pihole.lan -pihole_local_reverse_domain: '1.168.192.in-addr.arpa' +pihole_local_domain: + - domain: local.lan + resolver: "{{ pihole_local_resolver }}" + - domain: "1.168.192.in-addr.arpa" + resolver: "{{ pihole_local_resolver }}" pihole_local_resolver: pihole_dns_servers: - - '127.0.0.1' - - '{{pihole_local_resolver | default(1.1.1.1)}}' -pihole_update_container: false \ No newline at end of file + - "127.0.0.1" + - "{{pihole_local_resolver | default(1.1.1.1)}}" +pihole_update_container: false diff --git a/templates/02-localresolver.conf.j2 b/templates/02-localresolver.conf.j2 index d77cd10..c3e45f7 100644 --- a/templates/02-localresolver.conf.j2 +++ b/templates/02-localresolver.conf.j2 @@ -1,5 +1,5 @@ # {{ ansible_managed }} ## local domain forwarder -server=/local.lan/{{pihole_local_resolver}} -server=/{{pihole_local_domain}}/{{pihole_local_resolver}} -server=/{{pihole_local_reverse_domain}}/{{pihole_local_resolver}} +{% for localresolver in pihole_local_domain %} +server=/{{localresolver.domain}}/{{localresolver.resolver}} +{% endfor %}