From 382f1e98450868bf63d325582488f57d496a8cc9 Mon Sep 17 00:00:00 2001 From: Ahmed AbdelHalim Date: Tue, 21 Jul 2026 16:59:57 +0200 Subject: Fix pihole port allocation, this fixes caddy testing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit domain = {{ pihole_domain }} rendered as an unquoted bareword containing a dot (e.g. "pi.hole"), which is invalid TOML. TOML parsing is all-or-nothing, not line-by-line, so pihole-FTL rejected the entire config file on that one line and silently fell back to its compiled-in defaults — including binding its webserver directly to ports 80/443. That collided with caddy, which wants the same ports, causing caddy to crash-loop and get reported as "changed" (needing a restart) on every subsequent ansible run. Quoting the domain value lets the file parse successfully, which in turn surfaces a second, previously-unreachable bug: the custom webserver port (pihole_port) was rendered as a bare number, but Pi-hole v6 FTL requires each listener address to carry a trailing flag character (o = optional, s = TLS). Without it FTL rejects the value the same way and reverts to the 80/443 default. Appending "o" fixes that. Both bugs had to be fixed together: the quoting bug was blocking the parser from ever reaching the port line, so the port fix alone had no effect until parsing succeeded end-to-end. Co-Authored-By: Claude.ai --- roles/pihole/templates/pihole.toml.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/pihole/templates/pihole.toml.j2 b/roles/pihole/templates/pihole.toml.j2 index a755040b..f78551fa 100644 --- a/roles/pihole/templates/pihole.toml.j2 +++ b/roles/pihole/templates/pihole.toml.j2 @@ -61,11 +61,11 @@ hosts = {{ pihole_dhcp_hosts | to_nice_json }} [webserver] {% if (pihole_domain is defined) and (pihole_domain != '') %} -domain = {{ pihole_domain }} +domain = "{{ pihole_domain }}" {% endif %} {% if (pihole_port is defined) and (pihole_port != '') %} -port = "{{ pihole_port }}" +port = "{{ pihole_port }}o" [webserver.tls] cert = "" {% else %} -- cgit v1.2.3