summaryrefslogtreecommitdiffstats
path: root/roles/pihole/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'roles/pihole/tasks')
-rw-r--r--roles/pihole/tasks/main.yml15
1 files changed, 13 insertions, 2 deletions
diff --git a/roles/pihole/tasks/main.yml b/roles/pihole/tasks/main.yml
index 66208bdf..f6101632 100644
--- a/roles/pihole/tasks/main.yml
+++ b/roles/pihole/tasks/main.yml
@@ -151,7 +151,7 @@
- name: "Create pihole nginx vhost configuration"
become: true
- when: pihole_hostname | length > 0
+ when: proxy_type == "nginx" and pihole_hostname | length > 0
ansible.builtin.template:
src: "pihole.nginx.conf.j2"
dest: "/etc/nginx/vhosts.d/pihole.conf"
@@ -162,4 +162,15 @@
validate: >
bash -c 'echo "events { worker_connections 64; } http { include %s; }" > /tmp/nginx-vhost.conf;
sudo nginx -T -c /tmp/nginx-vhost.conf; ec=$?; rm -f /tmp/nginx-vhost.conf; exit $ec'
- notify: "Restart nginx"
+ notify: "Restart proxy"
+
+- name: "Create pihole caddy configuration"
+ become: true
+ when: proxy_type == "caddy" and pihole_hostname | length > 0
+ ansible.builtin.template:
+ src: "pihole.caddy.j2"
+ dest: "/etc/caddy/sites/pihole.caddy"
+ owner: "root"
+ group: "caddy"
+ mode: "0640"
+ notify: "Restart proxy"