summaryrefslogtreecommitdiffstats
path: root/roles/pihole/templates
diff options
context:
space:
mode:
authorAhmed Abdelhalim <[email protected]>2026-06-17 18:37:49 +0200
committerAhmed Abdelhalim <[email protected]>2026-06-17 18:42:02 +0200
commitc7a4dfce1ad0b545b05a8043e321ad49e48873a6 (patch)
treefe8a0bfc1bc31dc93a8138cce179df2416875bf4 /roles/pihole/templates
parentd9dcfdd822f90eb65117523d7c15694fae952bd2 (diff)
Refactor pi roles to use .home.arpa subdomains for services
Diffstat (limited to 'roles/pihole/templates')
-rw-r--r--roles/pihole/templates/pihole.nginx.conf.j217
-rw-r--r--roles/pihole/templates/pihole.toml.j23
2 files changed, 20 insertions, 0 deletions
diff --git a/roles/pihole/templates/pihole.nginx.conf.j2 b/roles/pihole/templates/pihole.nginx.conf.j2
new file mode 100644
index 00000000..91f0fea4
--- /dev/null
+++ b/roles/pihole/templates/pihole.nginx.conf.j2
@@ -0,0 +1,17 @@
+server {
+ listen 80;
+ listen [::]:80;
+
+ server_name {{ pihole_hostname }};
+
+ location = / {
+ return 301 /admin/;
+ }
+
+ location /admin/ {
+ proxy_pass http://127.0.0.1:{{ pihole_port }}/admin/;
+ }
+ location /api/ {
+ proxy_pass http://127.0.0.1:{{ pihole_port }}/api/;
+ }
+}
diff --git a/roles/pihole/templates/pihole.toml.j2 b/roles/pihole/templates/pihole.toml.j2
index 13f7ba1f..a755040b 100644
--- a/roles/pihole/templates/pihole.toml.j2
+++ b/roles/pihole/templates/pihole.toml.j2
@@ -37,6 +37,9 @@ interface = "{{ pihole_interface }}"
# - "NONE"
# Do not add any configuration concerning the listening mode to the dnsmasq config file.
listeningMode = "LOCAL"
+{% if pihole_dns_hosts | length > 0 %}
+hosts = {{ pihole_dns_hosts | to_json }}
+{% endif %}
[dns.cache]
size = 10000 # Cache size of the DNS server.